[Collab-qa-commits] r261 - testing-status
lucas at alioth.debian.org
lucas at alioth.debian.org
Mon Jul 2 20:17:28 UTC 2007
Author: lucas
Date: 2007-07-02 20:17:27 +0000 (Mon, 02 Jul 2007)
New Revision: 261
Modified:
testing-status/data2html.rb
testing-status/pkgtestingstatus.rb
Log:
testing-status fixes
Modified: testing-status/data2html.rb
===================================================================
--- testing-status/data2html.rb 2007-07-01 18:17:45 UTC (rev 260)
+++ testing-status/data2html.rb 2007-07-02 20:17:27 UTC (rev 261)
@@ -36,7 +36,6 @@
($curdate - p[1].sync < 10) or (p[1].inunstable != $curdate)
end
-
puts <<-EOF
<html>
<head>
Modified: testing-status/pkgtestingstatus.rb
===================================================================
--- testing-status/pkgtestingstatus.rb 2007-07-01 18:17:45 UTC (rev 260)
+++ testing-status/pkgtestingstatus.rb 2007-07-02 20:17:27 UTC (rev 261)
@@ -1,5 +1,8 @@
+require 'date'
+
class PkgTestingStatus
@@datezero = Date::parse('0000-01-01')
+ @@curdate = Date::today
attr_accessor :intesting, :testingversion, :inunstable, :unstableversion, :sync, :syncversion, :firstinunstable
def initialize(t,tv,u,uv, s, sv, fu)
@@ -24,7 +27,7 @@
else
d = @intesting
v = @testingversion
- days = $curdate - @intesting
+ days = @@curdate - @intesting
end
return "<td>#{d}</td><td>#{days}</td><td>#{v}</td>"
end
@@ -37,23 +40,56 @@
else
d = @sync
v = @syncversion
- days = $curdate - @sync
+ days = @@curdate - @sync
end
return "<td>#{d}</td><td>#{days}</td><td>#{v}</td>"
end
def testingdays
if @intesting != @@datezero
- return $curdate - @intesting
+ return @@curdate - @intesting
else
- return 10000 + ($curdate - @firstinunstable)
+ return 10000 + (@@curdate - @firstinunstable)
end
end
+
+ def testing_ok?(days)
+ if @intesting != @@datezero
+ if @@curdate - @intesting > days
+ return [false, @@curdate - @intesting ]
+ else
+ return [true, nil]
+ end
+ else
+ if @@curdate - @firstinunstable > days
+ return [false, @@curdate - @firstinunstable ]
+ else
+ return [true, nil]
+ end
+ end
+ end
+
+ def sync_ok?(days)
+ if @sync != @@datezero
+ if @@curdate - @sync > days
+ return [false, @@curdate - @sync]
+ else
+ return [true, nil]
+ end
+ else
+ if @@curdate - @firstinunstable > days
+ return [false, @@curdate - @firstinunstable ]
+ else
+ return [true, nil]
+ end
+ end
+ end
+
def syncdays
if @sync != @@datezero
- return $curdate - @sync
+ return @@curdate - @sync
else
- return 1000000 + 1000 * ($curdate - @intesting) + ($curdate - @firstinunstable)
+ return 1000000 + 1000 * (@@curdate - @intesting) + (@@curdate - @firstinunstable)
end
end
@@ -98,7 +134,7 @@
def PkgTestingStatus::read(io)
pkgs = {}
- STDIN.read.each_line do |l|
+ io.read.each_line do |l|
p, t, tv, u, uv, s, sv, fu = l.split(' ')
pkgs[p] = PkgTestingStatus::new(Date::parse(t), tv, Date::parse(u),
uv, Date::parse(s), sv, Date::parse(fu))
More information about the Collab-qa-commits
mailing list