Repository: WeblateOrg/weblate

Issue:
Client side pagination and sorting
**Describe the bug**
When sorting the components using the available columns (Strings, words, etc), it only performs the sort on the current pagination, not on the whole list of components. I noticed it because I wasn't understanding the global translations statistics of a language (not everything at 100%), while when sorting the components on the first page, everything was at 100%.
I understood when I went to the next page and saw that some stats were not at 100%.

**To Reproduce**
Steps to reproduce the behavior:
1. Create enough components to have 2 pages of components
2. Translates every components from the first page
3. Order the components by "String" in desc order
4. See that the components not translated from the second page are never shown

**Expected behavior**
The sorting of columns should be applied on all components, not just the ones that are currently displayed.



Discussion:

Resolving patch:
diff --git a/weblate/lang/views.py b/weblate/lang/views.py
--- a/weblate/lang/views.py
+++ b/weblate/lang/views.py
@@ -39,7 +39,7 @@
     ProjectLanguageStats,
     prefetch_stats,
 )
-from weblate.utils.views import get_paginator, get_project
+from weblate.utils.views import get_project
 
 
 def show_languages(request):
@@ -117,13 +117,11 @@ def show_project(request, lang, project):
         language=obj, project=pobj
     )[:10]
 
-    # Paginate translations.
     translation_list = (
         obj.translation_set.prefetch()
         .filter(component__project=pobj)
         .order_by("component__priority", "component__name")
     )
-    translations = get_paginator(request, translation_list)
 
     return render(
         request,
@@ -134,7 +132,7 @@ def show_project(request, lang, project):
             "project": pobj,
             "last_changes": last_changes,
             "last_changes_url": urlencode({"lang": obj.code, "project": pobj.slug}),
-            "translations": translations,
+            "translations": translation_list,
             "title": "{0} - {1}".format(pobj, obj),
             "search_form": SearchForm(request.user),
             "licenses": pobj.component_set.exclude(license="").order_by("license"),
diff --git a/weblate/trans/views/basic.py b/weblate/trans/views/basic.py
--- a/weblate/trans/views/basic.py
+++ b/weblate/trans/views/basic.py
@@ -56,7 +56,6 @@
 from weblate.utils.stats import GhostProjectLanguageStats, prefetch_stats
 from weblate.utils.views import (
     get_component,
-    get_paginator,
     get_project,
     get_translation,
     try_set_language,
@@ -164,9 +163,8 @@ def show_project(request, project):
         ),
     )
 
-    # Paginate components of project.
     all_components = obj.component_set.filter_access(user).prefetch().order()
-    components = prefetch_tasks(prefetch_stats(get_paginator(request, all_components)))
+    components = prefetch_tasks(prefetch_stats(all_components))
 
     return render(
         request,
diff --git a/weblate/trans/views/dashboard.py b/weblate/trans/views/dashboard.py
--- a/weblate/trans/views/dashboard.py
+++ b/weblate/trans/views/dashboard.py
@@ -38,7 +38,6 @@
 from weblate.trans.util import render
 from weblate.utils import messages
 from weblate.utils.stats import prefetch_stats
-from weblate.utils.views import get_paginator
 
 
 def get_untranslated(base, limit=None):
@@ -267,7 +266,7 @@ def dashboard_user(request):
             "allow_index": True,
             "suggestions": suggestions,
             "search_form": SearchForm(request.user),
-            "usersubscriptions": get_paginator(request, usersubscriptions),
+            "usersubscriptions": usersubscriptions,
             "componentlists": componentlists,
             "all_componentlists": prefetch_stats(
                 ComponentList.objects.filter(


Test patch: