From a64e1e04db6fc4ffc296ea462f9f8d394d51d9bc Mon Sep 17 00:00:00 2001 From: AbId KhAn Date: Tue, 20 Feb 2024 14:06:20 +0600 Subject: [PATCH] fix: previous year closed issues in analytics (#3672) * fix bug where previous year closed issues are showing #3668 * grouping import from same package since it was failed in GA #3668 --- apiserver/plane/app/views/analytic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apiserver/plane/app/views/analytic.py b/apiserver/plane/app/views/analytic.py index 04a77f789..6eb914b23 100644 --- a/apiserver/plane/app/views/analytic.py +++ b/apiserver/plane/app/views/analytic.py @@ -1,6 +1,7 @@ # Django imports from django.db.models import Count, Sum, F, Q from django.db.models.functions import ExtractMonth +from django.utils import timezone # Third party imports from rest_framework import status @@ -331,8 +332,9 @@ class DefaultAnalyticsEndpoint(BaseAPIView): .order_by("state_group") ) + current_year = timezone.now().year issue_completed_month_wise = ( - base_issues.filter(completed_at__isnull=False) + base_issues.filter(completed_at__year=current_year) .annotate(month=ExtractMonth("completed_at")) .values("month") .annotate(count=Count("*"))