Download:
child 292:7b640cb27fe2
parent 290:a08915486c39
291:76a67e1a5c73
Anton Shestakov <av6@dwimlabs.net>, Mon, 18 Sep 2017 14:27:41 +0800
viewer: short summary and a link to compare on check page when makes sense

2 файлов изменено, 35 вставок(+), 1 удалений(-) [+]
candolint/handlers.py file | annotate | diff | comparison | revisions
templates/check.html file | annotate | diff | comparison | revisions
--- a/candolint/handlers.py Sat Sep 16 17:41:43 2017 +0800
+++ b/candolint/handlers.py Mon Sep 18 14:27:41 2017 +0800
@@ -150,7 +150,20 @@
for line in lines:
if 'filename' in line:
line['link'] = adapter.get_line_url(check.change, line)
- self.render('check.html', project=project, check=check, lines=lines, adapter=adapter)
+ if check.success:
+ reference = (Check
+ .select(*Check.get_light_fields())
+ .join(Change)
+ .where(Check.project == check.project)
+ .where(Check.success == True)
+ .where(Check.change != check.change)
+ .where(Change.branch == check.change.branch)
+ .where(Check.ordinal < check.ordinal)
+ .order_by(Check.ordinal.desc())
+ .first())
+ else:
+ reference = None
+ self.render('check.html', project=project, check=check, lines=lines, adapter=adapter, reference=reference)
class CompareHandler(BaseHandler):
--- a/templates/check.html Sat Sep 16 17:41:43 2017 +0800
+++ b/templates/check.html Mon Sep 18 14:27:41 2017 +0800
@@ -46,6 +46,27 @@
</dl>
</div>
</div>
+ {% if reference is not None %}
+ <p>
+ Overall,
+ {% if check.errors > reference.errors %}
+ <span class="uk-text-danger">worse</span> than
+ {% elif check.errors < reference.errors %}
+ <span class="uk-text-success">better</span> than
+ {% else %}
+ {% if check.warnings > reference.warnings %}
+ <span class="uk-text-warning">worse</span> than
+ {% elif check.warnings < reference.warnings %}
+ <span class="uk-text-success">better</span> than
+ {% else %}
+ same as
+ {% end %}
+ {% end %}
+ <a href="{{ project.get_url() }}/{{ reference.ordinal }}">check #{{ reference.ordinal }}</a>,
+ the previous check on branch {{ change.branch }}
+ (<a href="{{ project.get_url() }}/{{ check.ordinal }}/compare/{{ reference.ordinal }}">compare</a>).
+ </p>
+ {% end %}
{% include ui/check-log.html %}
</div>
{% end %}