Skip to content

Instantly share code, notes, and snippets.

@mathjazz
Created July 16, 2024 19:01
Show Gist options
  • Save mathjazz/1afd009081c6667dcc65db238a6eb405 to your computer and use it in GitHub Desktop.
Save mathjazz/1afd009081c6667dcc65db238a6eb405 to your computer and use it in GitHub Desktop.
Sideshow:pontoon mathjazz$ git diff pontoon/
diff --git a/pontoon/contributors/utils.py b/pontoon/contributors/utils.py
index 840efcb42..6600252ae 100644
--- a/pontoon/contributors/utils.py
+++ b/pontoon/contributors/utils.py
@@ -381,14 +381,16 @@ def get_project_locale_contribution_counts(contributions_qs):
for item in (
contributions_qs.annotate(
+ month=TruncMonth("created_at"),
project_name=F("translation__entity__resource__project__name"),
project_slug=F("translation__entity__resource__project__slug"),
locale_name=F("translation__locale__name"),
locale_code=F("translation__locale__code"),
)
- .values("project_name", "project_slug", "locale_name", "locale_code")
+ .values("month", "project_name", "project_slug", "locale_name", "locale_code")
.annotate(count=Count("id"))
.values(
+ "month",
"project_name",
"project_slug",
"locale_name",
@@ -396,6 +398,7 @@ def get_project_locale_contribution_counts(contributions_qs):
"action_type",
"count",
)
+ .order_by("month")
):
key = (item["project_slug"], item["locale_code"])
count = item["count"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment