🐛 Week starts on monday, not sunday

This commit is contained in:
Nikolai R Kristiansen committed 2022-02-10 09:47:01 +01:00
1 parent 9fa6cfe0ee
commit ad96873493
1 file changed
+2 -2
+2 -2
View File
@@ -5,7 +5,7 @@ from typing import Type
from django.conf import settings
from django.db import models
from django.db.models import Count, Sum
from django.db.models.functions import Extract, ExtractHour, ExtractMonth, ExtractWeekDay, ExtractYear
from django.db.models.functions import Extract, ExtractHour, ExtractIsoWeekDay, ExtractMonth, ExtractYear
EXTERNAL_USER = "Ekstern"
@@ -87,7 +87,7 @@ class OrderManager(models.Manager):
return self.get_queryset().annotate(period=period).values("period").annotate(count=Count("id"))
def count_by_created_period(self, period: str):
periods = {"yearly": ExtractYear, "monthly": ExtractMonth, "daily": ExtractWeekDay, "hourly": ExtractHour}
periods = {"yearly": ExtractYear, "monthly": ExtractMonth, "daily": ExtractIsoWeekDay, "hourly": ExtractHour}
assert period in periods
return self.count_by_created(periods[period])