diff options
author | mguetlein <martin.guetlein@gmail.com> | 2012-07-25 16:46:32 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2012-07-25 16:46:32 +0200 |
commit | 96297d5c3596ee3b6f6cbfa6968274a598776e41 (patch) | |
tree | c36d0183ca6f9795cad97f93ca0ad1a53e7a30c4 | |
parent | a9bcce75bde9fc4e343f2a644849ee98aa03ac84 (diff) |
latest task stuff
-rw-r--r-- | application.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/application.rb b/application.rb index 247a149..6bb6b96 100644 --- a/application.rb +++ b/application.rb @@ -69,21 +69,20 @@ end get '/latest' do response['Content-Type'] = 'text/plain' ts = Task.all.sort - t = nil + running = [] ts.size.times do |i| t = Task[ts.size-i] if Time.now - Time.parse(t.created_at) > 60*60*24 - t = nil break elsif t.hasStatus=="Running" - break + running << t end - t = nil end s = "" - s << "'#{t.uri}' --- '#{t.created_at}' --- '#{t.hasStatus}' --- '#{t.title}'\n" if t - if t==nil or t!=ts[-1] - s << "...\n" if t + running.each do |t| + s << "'#{t.uri}' --- '#{t.created_at}' --- '#{t.hasStatus}' --- '#{t.title}'\n" + end + if running.size==nil or running[-1]!=ts[-1] t = ts[-1] s << "'#{t.uri}' --- '#{t.created_at}' --- '#{t.hasStatus}' --- '#{t.title}'\n" end |