Skip to content

Commit

Permalink
Merge pull request #1449 from arjclark/fix.rose_bush_integer_cycling
Browse files Browse the repository at this point in the history
rose bush: Fix integer cycle sorting
  • Loading branch information
matthewrmshin committed Oct 28, 2014
2 parents 79be2c2 + f8537de commit 78b9feb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/python/rose/suite_engine_procs/cylc.py
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 78b9feb

Please sign in to comment.