diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-02-22 19:55:05 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-02-22 19:55:05 +0100 |
commit | 74dd6f509092e294baf7650b6c1a0fd1cde4be4a (patch) | |
tree | 1e1383a77bda5c54c34fd2f5388df518cbba58a6 /timepollhead.rb | |
parent | 5676ca7738e2d53191493a3761cd11f14e83dbed (diff) |
sort numerical and than alphanumerical
Diffstat (limited to 'timepollhead.rb')
-rw-r--r-- | timepollhead.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/timepollhead.rb b/timepollhead.rb index b5abb72..c0e4547 100644 --- a/timepollhead.rb +++ b/timepollhead.rb @@ -204,7 +204,7 @@ END end times = concrete_times - realtimes = times.collect{|t| Time.parse(t) if t =~ /\d\d:\d\d/}.compact + realtimes = times.collect{|t| Time.parse(t) if t =~ /^\d\d:\d\d$/}.compact [9,16].each{|i| realtimes << Time.parse("#{i.to_s.rjust(2,"0")}:00")} ["firsttime","lasttime"].each{|t| @@ -311,7 +311,15 @@ END ret += timenavi(EARLIER,revision) (@firsttime..@lasttime).each{|i| times << "#{i.to_s.rjust(2,"0")}:00" } - times.flatten.compact.uniq.sort.each{|time| + times.flatten.compact.uniq.sort{|a,b| + if a =~ /^\d\d:\d\d$/ && !(b =~ /^\d\d:\d\d$/) + -1 + elsif !(a =~ /^\d\d:\d\d$/) && b =~ /^\d\d:\d\d$/ + 1 + else + a.to_i == b.to_i ? a <=> b : a.to_i <=> b.to_i + end + }.each{|time| ret +="<tr>\n<td class='navigation'>#{time}</td>" days.each{|day| timestamp = TimeString.new(day,time) |