summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest/views.py
diff options
context:
space:
mode:
authorMagnus Hagander2018-06-19 12:17:12 +0000
committerMagnus Hagander2018-06-19 12:17:57 +0000
commit3d9bc13b06c2d11431f288d7d66bca67cfe2f718 (patch)
tree77d44ccae2e3ddd402ac09f8ebfe903c4da23436 /pgcommitfest/commitfest/views.py
parent02eaccccf8ddd502bc514e7ce272196c45b5aeb9 (diff)
First stab at tracking build results
Diffstat (limited to 'pgcommitfest/commitfest/views.py')
-rw-r--r--pgcommitfest/commitfest/views.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index 3ee60e3..3a04115 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -20,7 +20,7 @@ from pgcommitfest.mailqueue.util import send_mail, send_simple_mail
from pgcommitfest.userprofile.util import UserWrapper
from models import CommitFest, Patch, PatchOnCommitFest, PatchHistory, Committer
-from models import MailThread
+from models import MailThread, PatchBuildStatus
from forms import PatchForm, NewPatchForm, CommentForm, CommitFestFilterForm
from forms import BulkEmailForm
from ajax import doAttachThread, refresh_single_thread
@@ -194,7 +194,8 @@ def commitfest(request, cfid):
(poc.status=ANY(%(openstatuses)s)) AS is_open,
(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=p.id) AS author_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=p.id) AS reviewer_names,
-(SELECT count(1) FROM commitfest_patchoncommitfest pcf WHERE pcf.patch_id=p.id) AS num_cfs
+(SELECT count(1) FROM commitfest_patchoncommitfest pcf WHERE pcf.patch_id=p.id) AS num_cfs,
+(SELECT json_agg(json_build_object('provider', providername, 'status', buildstatus, 'timestamp', status_timestamp, 'url', status_url)) FROM (SELECT DISTINCT ON (buildprovider_id) *, bp.name AS providername FROM commitfest_patchbuildstatus pbs INNER JOIN commitfest_buildprovider bp ON bp.id=buildprovider_id WHERE pbs.commitfest_id=%(cid)s AND pbs.patch_id=p.id ORDER BY buildprovider_id, status_timestamp DESC) x) AS buildstatus
FROM commitfest_patch p
INNER JOIN commitfest_patchoncommitfest poc ON poc.patch_id=p.id
INNER JOIN commitfest_topic t ON t.id=p.topic_id
@@ -247,6 +248,7 @@ def patch(request, cfid, patchid):
patch = get_object_or_404(Patch.objects.select_related(), pk=patchid, commitfests=cf)
patch_commitfests = PatchOnCommitFest.objects.select_related('commitfest').filter(patch=patch).order_by('-commitfest__startdate')
committers = Committer.objects.filter(active=True).order_by('user__last_name', 'user__first_name')
+ buildstatuses = PatchBuildStatus.objects.select_related('buildprovider').filter(commitfest=cf, patch=patch).order_by('buildprovider', '-status_timestamp').distinct('buildprovider')
#XXX: this creates a session, so find a smarter way. Probably handle
#it in the callback and just ask the user then?
@@ -270,6 +272,7 @@ def patch(request, cfid, patchid):
'cf': cf,
'patch': patch,
'patch_commitfests': patch_commitfests,
+ 'buildstatuses': buildstatuses,
'is_committer': is_committer,
'is_this_committer': is_this_committer,
'is_reviewer': is_reviewer,