intersect with all numbers at right position in code

This commit is contained in:
Maximilian Keßler 2021-09-16 19:18:30 +02:00
parent 44b299ad70
commit 187e6ab3b8

View file

@ -84,19 +84,19 @@ class Lectures(list):
return self[-1].number - 1
def parse_range_string_section(self, arg):
all_numbers = [lecture.number for lecture in self]
if 'all' in arg:
return all_numbers
return [lecture.number for lecture in self]
if '-' in arg:
start, end = [self.parse_lecture_spec(bit) for bit in arg.split('-')]
return list(set(all_numbers) & set(range(start, end + 1)))
return list(range(start, end + 1))
return [self.parse_lecture_spec(arg)]
def parse_range_string(self, arg):
all_numbers = [lecture.number for lecture in self]
sets = [set(self.parse_range_string_section(part)) for part in arg.split(',')]
return list(set.union(*sets))
return list(set.union(*sets) & set(all_numbers))
def new_lecture(self):
if len(self) != 0: