From 44b299ad70b969f859942cff60b0f9c90ba335bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 16 Sep 2021 19:10:04 +0200 Subject: [PATCH] allow lecture view specification to be a comma separated list --- scripts/lectures.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/lectures.py b/scripts/lectures.py index 71a737d..b027cc4 100755 --- a/scripts/lectures.py +++ b/scripts/lectures.py @@ -83,7 +83,7 @@ class Lectures(list): elif string == 'prev': 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] if 'all' in arg: return all_numbers @@ -94,6 +94,10 @@ class Lectures(list): 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): if len(self) != 0: new_lecture_number = self[-1].number + 1