--- a/candolint/handlers.py Sat Sep 23 13:12:20 2017 +0800
+++ b/candolint/handlers.py Sun Sep 24 12:25:05 2017 +0800
from difflib import unified_diff
-from peewee import DoesNotExist
+from peewee import fn, DoesNotExist
from tornado.escape import json_decode
from tornado.web import HTTPError, RequestHandler
from tornado.web import ErrorHandler as BaseErrorHandler
class IndexHandler(BaseHandler):
+ .select(Check.project_id, fn.MAX(Check.ordinal).alias('maxord'))
+ .group_by(Check.project_id)
+ .where(Check.project_id == latest.c.project_id)
+ .where(Check.ordinal == latest.c.maxord))
.select(Project, Change, *Check.get_light_fields())
- .group_by(Check.project)
+ .where(Check.id.in_(check_ids))
.order_by(Check.finished.desc(), Check.ordinal.desc()))
self.render('index.html', checks=checks)