Skip to content

Commit 04239d7

Browse files
committed
Add a short alias in the teplate for cfbot_results (#47)
It got a bit repetitive to keep typing `p.cfbot_results` and it didn't make the templates easy to read.
1 parent e13be36 commit 04239d7

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

pgcommitfest/commitfest/templates/commitfest.html

+11-9
Original file line numberDiff line numberDiff line change
@@ -91,34 +91,36 @@ <h3>{{p.is_open|yesno:"Active patches,Closed patches"}}</h3>
9191
<td><span class="label label-{{p.status|patchstatuslabel}}">{{p.status|patchstatusstring}}</span></td>
9292
<td>{%if p.targetversion%}<span class="label label-default">{{p.targetversion}}</span>{%endif%}</td>
9393
<td class="cfbot-summary">
94-
{%if not p.cfbot_results %}
94+
{%with p.cfbot_results as cfb%}
95+
{%if not cfb %}
9596
<span class="label label-default">Not processed</span>
96-
{%elif p.cfbot_results.needs_rebase %}
97-
<a href="{{p.cfbot_results.apply_url}}" title="View git apply logs">
97+
{%elif cfb.needs_rebase %}
98+
<a href="{{cfb.apply_url}}" title="View git apply logs">
9899
<span class="label label-warning">Needs rebase!</span>
99100
</a>
100101
{%else%}
101102
<a href="https://github.com/postgresql-cfbot/postgresql/compare/cf/{{p.id}}~1...cf/{{p.id}}" title="View last patch set on GitHub"><img class="github-logo" src="/media/commitfest/github-mark.svg"/></a>
102103
<a href="https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F{{p.id}}"
103-
title="View CI history{%if p.cfbot_results.failed_task_names %}. Failed jobs: {{p.cfbot_results.failed_task_names}}{%endif%}">
104-
{%if p.cfbot_results.failed > 0 or p.cfbot_results.branch_status == 'failed' or p.cfbot_results.branch_status == 'timeout' %}
104+
title="View CI history{%if cfb.failed_task_names %}. Failed jobs: {{cfb.failed_task_names}}{%endif%}">
105+
{%if cfb.failed > 0 or cfb.branch_status == 'failed' or cfb.branch_status == 'timeout' %}
105106
<img src="/media/commitfest/new_failure.svg"/>
106-
{%elif p.cfbot_results.completed < p.cfbot_results.total %}
107+
{%elif cfb.completed < cfb.total %}
107108
<img src="/media/commitfest/running.svg"/>
108109
{%else%}
109110
<img src="/media/commitfest/new_success.svg"/>
110111
{%endif%}
111112
<span class="run-counters">
112-
{{p.cfbot_results.completed}}/{{p.cfbot_results.total}}
113+
{{cfb.completed}}/{{cfb.total}}
113114
</span>
114115
</a>
115116
{%endif%}
116117
</td>
117118
<td>
118-
{%if p.cfbot_results and p.cfbot_results.all_additions is not none %}
119-
<span class="additions">+{{ p.cfbot_results.all_additions }}</span><span class="deletions">&#8722;{{ p.cfbot_results.all_deletions }}</span>
119+
{%if cfb and cfb.all_additions is not none %}
120+
<span class="additions">+{{ cfb.all_additions }}</span><span class="deletions">&#8722;{{ cfb.all_deletions }}</span>
120121
{%endif%}
121122
</td>
123+
{%endwith%}
122124
<td>{{p.author_names|default:''}}</td>
123125
<td>{{p.reviewer_names|default:''}}</td>
124126
<td>{{p.committer|default:''}}</td>

0 commit comments

Comments
 (0)