Anton Shestakov <av6@dwimlabs.net>, Wed, 13 Jul 2016 00:02:04 +0800
models: don't count ids in Check.get_next_ordinal(), get current + 1 instead
--- a/candolint/models.py Tue Jul 12 23:45:37 2016 +0800
+++ b/candolint/models.py Wed Jul 13 00:02:04 2016 +0800
def get_next_ordinal(cls, project):
- count = cls.select(pw.fn.COUNT(cls.id)).where(cls.project == project)
+ .select(pw.fn.COALESCE(pw.fn.MAX(cls.ordinal), 0))
+ .where(cls.project == project))