Download:
child 326:8103caf34149
parent 324:379f61e6569d
325:9ee96b2a1610
Anton Shestakov <av6@dwimlabs.net>, Tue, 28 Nov 2017 11:58:11 +0800
viewer: return early in CheckHandler.get_chart_data()

1 файлов изменено, 16 вставок(+), 15 удалений(-) [+]
candolint/handlers.py file | annotate | diff | comparison | revisions
--- a/candolint/handlers.py Tue Nov 28 11:56:47 2017 +0800
+++ b/candolint/handlers.py Tue Nov 28 11:58:11 2017 +0800
@@ -188,23 +188,24 @@
history = list(reversed(checks
.limit(limit)
.offset(max(0, more - limit))))
- if len(history) > 2:
- points = [
- {
- 'ordinal': c.ordinal,
- 'errors': c.errors if c.success else None,
- 'warnings': c.warnings if c.success else None,
- 'duration': int((c.finished - c.started).total_seconds())
- } for c in history
- ]
- return {
- 'points': points,
- 'current': check.ordinal,
- 'projectURL': check.project.get_url()
- }
- else:
+
+ if len(history) < 3:
return {}
+ points = [
+ {
+ 'ordinal': c.ordinal,
+ 'errors': c.errors if c.success else None,
+ 'warnings': c.warnings if c.success else None,
+ 'duration': int((c.finished - c.started).total_seconds())
+ } for c in history
+ ]
+ return {
+ 'points': points,
+ 'current': check.ordinal,
+ 'projectURL': check.project.get_url()
+ }
+
def get_files_and_codes(self, check, lines):
if not check.success or not (check.errors or check.warnings):
return {}, {}