From ad96873493fc618a75fb0d6c4f4059932daff6f3 Mon Sep 17 00:00:00 2001 From: Nikolai R Kristiansen Date: Thu, 10 Feb 2022 09:47:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Week=20starts=20on=20monday,=20n?= =?UTF-8?q?ot=20sunday?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/models.py b/main/models.py index 1bd4599..fdb08b6 100755 --- a/main/models.py +++ b/main/models.py @@ -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])