comparison extra/soundsoftware/get-statistics.rb @ 976:0befb332f41a get_statistics

get stats up to current date
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 25 Oct 2012 13:50:45 +0100
parents 30040a8e3a88
children f6ede18f3e6e
comparison
equal deleted inserted replaced
973:30040a8e3a88 976:0befb332f41a
23 months << end_date 23 months << end_date
24 end 24 end
25 25
26 def weeks_between(d1, d2) 26 def weeks_between(d1, d2)
27 weeks = [] 27 weeks = []
28 start_date = Date.civil(d1.year, d1.month, 1) 28 start_date = Date.civil(d1.year, d1.month, d1.day)
29 end_date = Date.civil(d2.year, d2.month, 1) 29 end_date = Date.civil(d2.year, d2.month, d2.day)
30 30
31 raise ArgumentError unless d1 <= d2 31 raise ArgumentError unless d1 <= d2
32 32
33 while (start_date < end_date) 33 while (start_date < end_date)
34 weeks << start_date 34 weeks << start_date