-
Notifications
You must be signed in to change notification settings - Fork 0
Statistics on number of requests per year month
Graeme Porteous edited this page Jul 15, 2022
·
1 revision
Can generate a CSV of the number of requests delivered successfully per year/month by running:
dates = Submission.delivered_successfully.order(:updated_at).pluck(:updated_at)
grouped_dates = dates.inject(Hash.new(0)) do |m, d|
m[d.strftime("%Y-%m")] += 1
m
end
grouped_dates.each { |k,v| puts "#{k}, #{v}" }
If you want to filter for a given case management system, this currently has to be done by looking at the reference format:
Submission.where("reference LIKE 'FOI-%'") # Infreemation
Submission.where.not("reference LIKE 'FOI-%'") # Not Infreemation - so iCasework as that the only other system we integrate with