From 9281ca7d50986c8a19940313f0b4283058a3b518 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 27 Sep 2021 15:20:56 +0100 Subject: [PATCH] Sort services and orgs in presentation layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The model layer shouldn’t need to be concerned with sorting. For services this means we can make a `SerialisedModelCollection` rather than writing a manual loop. --- app/models/user.py | 4 ++-- app/templates/views/choose-account.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/user.py b/app/models/user.py index 43cd9a231..39dcd5d86 100644 --- a/app/models/user.py +++ b/app/models/user.py @@ -293,9 +293,9 @@ class User(JSONModel, UserMixin): @property def services(self): from app.models.service import Service - return sorted( + return [ Service(service) for service in self.orgs_and_services['services'] - ) + ] @property def services_with_organisation(self): diff --git a/app/templates/views/choose-account.html b/app/templates/views/choose-account.html index c5f3f78df..6c96efb84 100644 --- a/app/templates/views/choose-account.html +++ b/app/templates/views/choose-account.html @@ -19,7 +19,7 @@ {% else %}