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> <html>
<body> <body>
<h4>Nouveaut&eacute;s</h4> {% regroup issues by info.issue_type as issue_types %}
{% for issue_type, sub_issues in issue_types %}
<ul> {% if issue_type and issue_type != 'TECH' %}
{% spaceless %} {% if issue_type == 'NEW' %}
{% for issue in issues %} <h4>Nouveaut&eacute;s</h4>
{% if issue.info.issue_type == 'NEW' %} {% 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> <li>{% if issue.info.wording %}{{ issue.info.wording }}{% else %}{{ issue.subject }} (<a href="{{ issue.url }}">#{{ issue.id }}</a>){% endif %}</li>
{% endif %} {% endfor %}
{% endfor %} </ul>
{% endspaceless %} {% endif %}
</ul> {% endfor %}
<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>
</body> </body>
</html> </html>

View File

@ -12,7 +12,7 @@ from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from .forms import IssueInfoForm 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 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[int(info.issue_id)].info = info
issues = list(issues.values()) issues = list(issues.values())
issues.sort(key=lambda x: int(x.id)) issue_types = [x[0] for x in ISSUE_TYPES]
issues.sort(key=lambda x: sorted(x.modules.keys())) 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 return issues