aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--views.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/views.py b/views.py
index 424e355..40c08b9 100644
--- a/views.py
+++ b/views.py
@@ -14,17 +14,17 @@ def index(request):
groups = Group.objects.filter(tp__isnull=False).order_by("name")
current_year, current_week, _ = timezone.now().isocalendar()
+ start, _ = get_week(current_year, current_week)
for group in groups:
- courses = Course.objects.get_courses_for_group(group).values("begin").annotate(count=Count("begin"))
+ courses = Course.objects.get_courses_for_group(group, begin__gte=start).values("begin").annotate(count=Count("begin"))
weeks = []
for course in courses:
year, week, _ = course["begin"].isocalendar()
+ date, _ = get_week(year, week)
- if year >= current_year and week >= current_week:
- date, _ = get_week(year, week)
- if date not in weeks:
- weeks.append(date)
+ if date not in weeks:
+ weeks.append(date)
group.weeks = weeks