← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pelpsi/launchpad:alphabetical-sort-orderd-unhelpful-codenames into launchpad:master

 

Simone has proposed merging ~pelpsi/launchpad:alphabetical-sort-orderd-unhelpful-codenames into launchpad:master.

Commit message:
Current alphabetical sort order for Ubuntu codenames is unhelpful

translation sorted by distroseries.version instead of (distroseries.name, package.name)

LP: #1923378

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pelpsi/launchpad/+git/launchpad/+merge/439077
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad:alphabetical-sort-orderd-unhelpful-codenames into launchpad:master.
diff --git a/lib/lp/registry/interfaces/product.py b/lib/lp/registry/interfaces/product.py
index a27236b..77c0d25 100644
--- a/lib/lp/registry/interfaces/product.py
+++ b/lib/lp/registry/interfaces/product.py
@@ -920,7 +920,7 @@ class IProductView(
 
     translatable_packages = Attribute(
         "A list of the source packages for this product that can be "
-        "translated sorted by distroseries.name and sourcepackage.name."
+        "translated sorted by distroseries.version"
     )
 
     translatable_series = Attribute(
diff --git a/lib/lp/registry/model/product.py b/lib/lp/registry/model/product.py
index f7c3b99..97e7a83 100644
--- a/lib/lp/registry/model/product.py
+++ b/lib/lp/registry/model/product.py
@@ -1270,8 +1270,12 @@ class Product(
             if package.has_current_translation_templates
         }
 
-        # Sort packages by distroseries.name and package.name
-        return sorted(packages, key=lambda p: (p.distroseries.name, p.name))
+        # Sort packages by distroseries.version
+        return sorted(
+            packages,
+            key=lambda p: (p.distroseries.version),
+            reverse=True,
+        )
 
     @property
     def translatable_series(self):

Follow ups