Skip to content

Commit

Permalink
Use locale's total_strings for GET <locale>/<slug>/parts/
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Dec 18, 2024
1 parent 008fa56 commit ff95768
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pontoon/base/models/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def stats(self):
{
"title": "all-resources",
"resource__path": [],
# FIXME rename as total_strings
"resource__total_strings": self.total_strings,
"pretranslated_strings": self.pretranslated_strings,
"strings_with_errors": self.strings_with_errors,
Expand All @@ -409,6 +410,7 @@ def get_details(parts):
"title",
"resource__path",
"resource__deadline",
# FIXME rename as total_strings
"resource__total_strings",
"pretranslated_strings",
"strings_with_errors",
Expand All @@ -421,7 +423,12 @@ def get_details(parts):
resource__project=project, resource__entities__obsolete=False, locale=self
).distinct()
details = list(
get_details(translatedresources.annotate(title=F("resource__path")))
get_details(
translatedresources.annotate(
resource__total_strings=F("total_strings"),
title=F("resource__path"),
)
)
)

all_resources = ProjectLocale.objects.get(project=project, locale=self)
Expand All @@ -430,6 +437,7 @@ def get_details(parts):
"title": "all-resources",
"resource__path": [],
"resource__deadline": [],
# FIXME rename as total_strings
"resource__total_strings": all_resources.total_strings,
"pretranslated_strings": all_resources.pretranslated_strings,
"strings_with_errors": all_resources.strings_with_errors,
Expand Down

0 comments on commit ff95768

Please sign in to comment.