Skip to content

Commit

Permalink
Fix integer cycle sorting for bush.
Browse files Browse the repository at this point in the history
  • Loading branch information
arjclark committed Oct 28, 2014
1 parent 35185c0 commit f8537de
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/python/rose/suite_engine_procs/cylc.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,14 @@ def get_suite_cycles_summary(self, user_name, suite_name, limit, offset):
break
if not of_n_entries:
return ([], 0)

integer_mode = True
stmt = "SELECT DISTINCT cycle FROM task_states"
for row in self._db_exec(self.SUITE_DB, user_name, suite_name, stmt):
if not row[0].isdigit():
integer_mode = False
break

stmt_args = self.state_of.keys()
stmt = (
"SELECT cycle, fail_count, max(time_updated), group_concat(status)"
Expand All @@ -505,7 +513,11 @@ def get_suite_cycles_summary(self, user_name, suite_name, limit, offset):
if i:
stmt += " OR"
stmt += " status==?"
stmt += ") GROUP BY cycle ORDER BY cycle DESC"
if integer_mode:
stmt += ") GROUP BY cycle ORDER BY cast(cycle as number) DESC"
else:
stmt += ") GROUP BY cycle ORDER BY cycle DESC"

if limit:
stmt += " LIMIT ? OFFSET ?"
stmt_args += [limit, offset]
Expand Down

0 comments on commit f8537de

Please sign in to comment.