forked from github/plane
fix: analytics (#1037)
* fix: most issue created by user keys * fix: cycle and module filters for GET method
This commit is contained in:
parent
6e9235e5fe
commit
6a78948113
@ -1,16 +1,8 @@
|
|||||||
# Django imports
|
# Django imports
|
||||||
from django.db.models import (
|
from django.db.models import (
|
||||||
Q,
|
|
||||||
Count,
|
Count,
|
||||||
Sum,
|
Sum,
|
||||||
Value,
|
|
||||||
Case,
|
|
||||||
When,
|
|
||||||
FloatField,
|
|
||||||
Subquery,
|
|
||||||
OuterRef,
|
|
||||||
F,
|
F,
|
||||||
ExpressionWrapper,
|
|
||||||
)
|
)
|
||||||
from django.db.models.functions import ExtractMonth
|
from django.db.models.functions import ExtractMonth
|
||||||
|
|
||||||
@ -238,8 +230,8 @@ class DefaultAnalyticsEndpoint(BaseAPIView):
|
|||||||
.order_by("month")
|
.order_by("month")
|
||||||
)
|
)
|
||||||
most_issue_created_user = (
|
most_issue_created_user = (
|
||||||
queryset.filter(created_by__isnull=False)
|
queryset.exclude(created_by=None)
|
||||||
.values("assignees__email", "assignees__avatar")
|
.values("created_by__email", "created_by__avatar")
|
||||||
.annotate(count=Count("id"))
|
.annotate(count=Count("id"))
|
||||||
.order_by("-count")
|
.order_by("-count")
|
||||||
)[:5]
|
)[:5]
|
||||||
|
@ -213,7 +213,7 @@ def filter_cycle(params, filter, method):
|
|||||||
if method == "GET":
|
if method == "GET":
|
||||||
cycles = params.get("cycle").split(",")
|
cycles = params.get("cycle").split(",")
|
||||||
if len(cycles) and "" not in cycles:
|
if len(cycles) and "" not in cycles:
|
||||||
filter["cycle__in"] = cycles
|
filter["issue_cycle__cycle_id__in"] = cycles
|
||||||
else:
|
else:
|
||||||
if params.get("cycle", None) and len(params.get("cycle")):
|
if params.get("cycle", None) and len(params.get("cycle")):
|
||||||
filter["issue_cycle__cycle_id__in"] = params.get("cycle")
|
filter["issue_cycle__cycle_id__in"] = params.get("cycle")
|
||||||
@ -224,7 +224,7 @@ def filter_module(params, filter, method):
|
|||||||
if method == "GET":
|
if method == "GET":
|
||||||
modules = params.get("module").split(",")
|
modules = params.get("module").split(",")
|
||||||
if len(modules) and "" not in modules:
|
if len(modules) and "" not in modules:
|
||||||
filter["module__in"] = modules
|
filter["issue_module__module_id__in"] = modules
|
||||||
else:
|
else:
|
||||||
if params.get("module", None) and len(params.get("module")):
|
if params.get("module", None) and len(params.get("module")):
|
||||||
filter["issue_module__module_id__in"] = params.get("module")
|
filter["issue_module__module_id__in"] = params.get("module")
|
||||||
|
Loading…
Reference in New Issue
Block a user