Download:
child 136:9576736033f6
parent 134:c750ded699ca
135:74b36212f1f9
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

1 файлов изменено, 4 вставок(+), 2 удалений(-) [+]
candolint/models.py file | annotate | diff | comparison | revisions
--- a/candolint/models.py Tue Jul 12 23:45:37 2016 +0800
+++ b/candolint/models.py Wed Jul 13 00:02:04 2016 +0800
@@ -115,5 +115,7 @@
@classmethod
def get_next_ordinal(cls, project):
- count = cls.select(pw.fn.COUNT(cls.id)).where(cls.project == project)
- return count + 1
+ max_ordinal = (cls
+ .select(pw.fn.COALESCE(pw.fn.MAX(cls.ordinal), 0))
+ .where(cls.project == project))
+ return max_ordinal + 1