From 4682977f8b2d25fc5d84b013c8ff659f8c30d0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= Date: Thu, 1 Jun 2023 16:36:41 +0200 Subject: [PATCH] sort tickets by issue_type (#77957) --- .../templates/projects/date_export.html | 50 ++++++------------- scrutiny/projects/views.py | 12 +++-- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/scrutiny/projects/templates/projects/date_export.html b/scrutiny/projects/templates/projects/date_export.html index 0ee2510..798a4e9 100644 --- a/scrutiny/projects/templates/projects/date_export.html +++ b/scrutiny/projects/templates/projects/date_export.html @@ -1,39 +1,21 @@ -

Nouveautés

- - + {% endif %} + {% endfor %} diff --git a/scrutiny/projects/views.py b/scrutiny/projects/views.py index 418b957..6fba191 100644 --- a/scrutiny/projects/views.py +++ b/scrutiny/projects/views.py @@ -12,7 +12,7 @@ from django.views.generic.base import TemplateView from django.views.generic.detail import DetailView from .forms import IssueInfoForm -from .models import InstalledService, InstalledVersion, IssueInfo, Module, Project +from .models import ISSUE_TYPES, InstalledService, InstalledVersion, IssueInfo, Module, Project from .utils import CommitAndIssues, Issue, decorate_commit_line, get_issue_deployment_status @@ -222,8 +222,14 @@ class IssuesMixin: issues[int(info.issue_id)].info = info issues = list(issues.values()) - issues.sort(key=lambda x: int(x.id)) - issues.sort(key=lambda x: sorted(x.modules.keys())) + issue_types = [x[0] for x in ISSUE_TYPES] + issues.sort( + key=lambda x: ( + issue_types.index(x.info.issue_type) if hasattr(x, 'info') and x.info.issue_type else 42, + sorted(x.modules.keys()), + int(x.id), + ) + ) return issues -- 2.39.2