From fad80bbee3f5ba22d25d098bccb06dc982cf32be Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 6 Feb 2014 10:59:25 +1100 Subject: [PATCH] Sort schedules by "next run due" time --- lib/scheduler/web.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/scheduler/web.rb b/lib/scheduler/web.rb index 3b6574a3d..8b580f2e3 100644 --- a/lib/scheduler/web.rb +++ b/lib/scheduler/web.rb @@ -5,8 +5,10 @@ module Scheduler def self.registered(app) app.get "/scheduler" do - @schedules = Scheduler::Manager.discover_schedules @manager = Scheduler::Manager.without_runner + @schedules = Scheduler::Manager.discover_schedules.sort do |a,b| + a.schedule_info.next_run <=> b.schedule_info.next_run + end erb File.read(File.join(VIEWS, 'scheduler.erb')), locals: {view_path: VIEWS} end