From 187e6ab3b8b4c5d64cba00e8998817e7890a0786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 16 Sep 2021 19:18:30 +0200 Subject: [PATCH] intersect with all numbers at right position in code --- scripts/lectures.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/lectures.py b/scripts/lectures.py index b027cc4..5c2ea83 100755 --- a/scripts/lectures.py +++ b/scripts/lectures.py @@ -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: