fix: default analytic estimate points and sorting for custom analytics (#1066)

This commit is contained in:
pablohashescobar 2023-05-17 14:58:45 +05:30 committed by GitHub
parent ab695a309f
commit 27626fb16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -261,11 +261,13 @@ class DefaultAnalyticsEndpoint(BaseAPIView):
)
open_estimate_sum = (
Issue.objects.filter(
queryset.filter(
state__group__in=["backlog", "unstarted", "started"]
).aggregate(open_estimate_sum=Sum("estimate_point"))
)["open_estimate_sum"]
total_estimate_sum = Issue.objects.aggregate(
print(open_estimate_sum)
total_estimate_sum = queryset.aggregate(
total_estimate_sum=Sum("estimate_point")
)["total_estimate_sum"]

View File

@ -72,5 +72,5 @@ def build_graph_plot(queryset, x_axis, y_axis, segment=None):
order = ["low", "medium", "high", "urgent", "None"]
sorted_data = {key: grouped_data[key] for key in order if key in grouped_data}
else:
sorted_data = dict(sorted(grouped_data.items(), key=lambda x: (x[0] is "None", x[0])))
sorted_data = dict(sorted(grouped_data.items(), key=lambda x: (x[0] == "None", x[0])))
return sorted_data