Show the number of CFs a patch has been on
authorMagnus Hagander <magnus@hagander.net>
Tue, 29 May 2018 18:25:12 +0000 (14:25 -0400)
committerMagnus Hagander <magnus@hagander.net>
Tue, 29 May 2018 18:25:12 +0000 (14:25 -0400)
Per discussions at the developer meeting, show the number of CFs a patch
has been on, and make it possible to sort on this value.

pgcommitfest/commitfest/templates/commitfest.html
pgcommitfest/commitfest/views.py

index 63f6a25b09a0c61120dc5e5a9e1ea02f2c4f4baa..009ff5e35df835e0387c2f45c58fde3d81773578 100644 (file)
@@ -65,6 +65,7 @@
    <th>Author</th>
    <th>Reviewers</th>
    <th>Committer</th>
+   <th>{%if p.is_open%}<a href="#" style="color:#333333;" onclick="return sortpatches(3);">Num cfs</a>{%if sortkey == 3%}<div style="float:right;"><i class="glyphicon glyphicon-arrow-down"></i></div>{%endif%}{%else%}Num cfs{%endif%}</th>
    <th>{%if p.is_open%}<a href="#" style="color:#333333;" onclick="return sortpatches(1);">Latest activity</a>{%if sortkey == 1%}<div style="float:right;"><i class="glyphicon glyphicon-arrow-down"></i></div>{%endif%}{%else%}Latest activity{%endif%}</th>
    <th>{%if p.is_open%}<a href="#" style="color:#333333;" onclick="return sortpatches(2);">Latest mail</a>{%if sortkey == 2%}<div style="float:right;"><i class="glyphicon glyphicon-arrow-down"></i></div>{%endif%}{%else%}Latest mail{%endif%}</th>
 {%if user.is_staff%}
@@ -86,6 +87,7 @@
    <td>{{p.author_names|default:''}}</td>
    <td>{{p.reviewer_names|default:''}}</td>
    <td>{{p.committer|default:''}}</td>
+   <td>{{p.num_cfs}}</td>
    <td style="white-space: nowrap;">{{p.modified|date:"Y-m-d"}}<br/>{{p.modified|date:"H:i"}}</td>
    <td style="white-space: nowrap;">{{p.lastmail|date:"Y-m-d"}}<br/>{{p.lastmail|date:"H:i"}}</td>
 {%if user.is_staff%}
index 049610f84c985c83fd4df4e9d13055a44ef7d886..5a5505f89067f1d5629d5fa19d44767e5c93ab0c 100644 (file)
@@ -159,6 +159,8 @@ def commitfest(request, cfid):
                        ordering = ['-is_open', 'modified', 'created',]
                elif sortkey==2:
                        ordering = ['-is_open', 'lastmail', 'created',]
+               elif sortkey==3:
+                       ordering = ['-is_open', '-num_cfs', 'modified', 'created']
                else:
                        sortkey=0
        else:
@@ -173,6 +175,7 @@ def commitfest(request, cfid):
                'author_names':"SELECT string_agg(first_name || ' ' || last_name || ' (' || username || ')', ', ') FROM auth_user INNER JOIN commitfest_patch_authors cpa ON cpa.user_id=auth_user.id WHERE cpa.patch_id=commitfest_patch.id",
                'reviewer_names':"SELECT string_agg(first_name || ' ' || last_name || ' (' || username || ')', ', ') FROM auth_user INNER JOIN commitfest_patch_reviewers cpr ON cpr.user_id=auth_user.id WHERE cpr.patch_id=commitfest_patch.id",
                'is_open':'commitfest_patchoncommitfest.status IN (%s)' % ','.join([str(x) for x in PatchOnCommitFest.OPEN_STATUSES]),
+               'num_cfs': 'SELECT count(1) FROM commitfest_patchoncommitfest pcf WHERE pcf.patch_id=commitfest_patch.id',
        }).order_by(*ordering))
 
        # Generate patch status summary.