From 4b9e2c5692261dacf70acfe6a8997c0c60d19c6b Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 23 Jul 2015 11:54:04 +0100 Subject: templates/patch-list: Add patch "checks" column Add a column to display the important "checks" fields for each patch. Note that only the "completed" checks are shown (i.e. "in progress" and "not started" checks are ignored). Signed-off-by: Stephen Finucane --- patchwork/templatetags/patch.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'patchwork/templatetags') diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py index 3b28158..26cfc13 100644 --- a/patchwork/templatetags/patch.py +++ b/patchwork/templatetags/patch.py @@ -1,5 +1,6 @@ # Patchwork - automated patch tracking system # Copyright (C) 2008 Jeremy Kerr +# Copyright (C) 2015 Intel Corporation # # This file is part of the Patchwork package. # @@ -20,6 +21,8 @@ from django import template from django.utils.safestring import mark_safe +from patchwork.models import Check + register = template.Library() @@ -37,3 +40,14 @@ def patch_tags(patch): return mark_safe('%s' % ( ' / '.join(titles), ' '.join(counts))) + + +@register.filter(name='patch_checks') +def patch_checks(patch): + required = [Check.STATE_SUCCESS, Check.STATE_WARNING, Check.STATE_FAIL] + titles = ['Success', 'Warning', 'Fail'] + counts = patch.check_count + + return mark_safe('%s' % ( + ' / '.join(titles), + ' '.join([str(counts[state]) for state in required]))) -- cgit v1.2.3