sort tickets by issue_type (#77957) #9

Merged
lguerin merged 1 commits from wip/77957-sort-tickets into main 2023-06-02 11:29:59 +02:00
2 changed files with 25 additions and 37 deletions

View File

@ -1,39 +1,21 @@
<html>
<body>
<h4>Nouveaut&eacute;s</h4>
<ul>
{% spaceless %}
{% for issue in issues %}
{% if issue.info.issue_type == 'NEW' %}
{% regroup issues by info.issue_type as issue_types %}
{% for issue_type, sub_issues in issue_types %}
{% if issue_type and issue_type != 'TECH' %}
{% if issue_type == 'NEW' %}
<h4>Nouveaut&eacute;s</h4>
{% elif issue_type == 'BUGFIX' %}
<h4>Corrections</h4>
{% elif issue_type == 'DEV' %}
<h4>D&eacute;veloppement</h4>
{% endif %}
<ul>
{% for issue in sub_issues %}
<li>{% if issue.info.wording %}{{ issue.info.wording }}{% else %}{{ issue.subject }} (<a href="{{ issue.url }}">#{{ issue.id }}</a>){% endif %}</li>
{% endif %}
{% endfor %}
{% endspaceless %}
</ul>
<h4>Corrections</h4>
<ul>
{% spaceless %}
{% for issue in issues %}
{% if issue.info.issue_type == 'BUGFIX' %}
<li>{% if issue.info.wording %}{{ issue.info.wording }}{% else %}{{ issue.subject }} (<a href="{{ issue.url }}">#{{ issue.id }}</a>){% endif %}</li>
{% endif %}
{% endfor %}
{% endspaceless %}
</ul>
<h4>D&eacute;veloppement</h4>
<ul>
{% spaceless %}
{% for issue in issues %}
{% if issue.info.issue_type == 'DEV' %}
<li>{% if issue.info.wording %}{{ issue.info.wording }}{% else %}{{ issue.subject }} (<a href="{{ issue.url }}">#{{ issue.id }}</a>){% endif %}</li>
{% endif %}
{% endfor %}
{% endspaceless %}
</ul>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
</body>
</html>

View File

@ -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