allow lecture view specification to be a comma separated list

This commit is contained in:
Maximilian Keßler 2021-09-16 19:10:04 +02:00
parent 81b46dd01b
commit 44b299ad70

View file

@ -83,7 +83,7 @@ class Lectures(list):
elif string == 'prev': elif string == 'prev':
return self[-1].number - 1 return self[-1].number - 1
def parse_range_string(self, arg): def parse_range_string_section(self, arg):
all_numbers = [lecture.number for lecture in self] all_numbers = [lecture.number for lecture in self]
if 'all' in arg: if 'all' in arg:
return all_numbers return all_numbers
@ -94,6 +94,10 @@ class Lectures(list):
return [self.parse_lecture_spec(arg)] return [self.parse_lecture_spec(arg)]
def parse_range_string(self, arg):
sets = [set(self.parse_range_string_section(part)) for part in arg.split(',')]
return list(set.union(*sets))
def new_lecture(self): def new_lecture(self):
if len(self) != 0: if len(self) != 0:
new_lecture_number = self[-1].number + 1 new_lecture_number = self[-1].number + 1