|
|
@@ -49,8 +49,31 @@ def create_output_dir |
|
|
|
end |
|
|
|
|
|
|
|
def gen_homepage |
|
|
|
decisions = ScraperWiki.select("* from `applications` order by date_decision desc limit 20") |
|
|
|
write_page('.', 'index', { decisions: decisions }) |
|
|
|
summary = ScraperWiki.select(" |
|
|
|
authority_name, status, decision, appeal_status, appeal_decision, count(*) as applications |
|
|
|
from applications |
|
|
|
group by authority_name, status, decision, appeal_status, appeal_decision |
|
|
|
") |
|
|
|
write_page('.', 'index', { summary: summary }) |
|
|
|
|
|
|
|
# Summary CSV file |
|
|
|
csv_string = CSV.generate do |csv| |
|
|
|
csv << summary.first.keys # header row |
|
|
|
summary.each { |row| csv << row.values } |
|
|
|
end |
|
|
|
|
|
|
|
write_csv('.', 'inlink-summary', csv_string) |
|
|
|
|
|
|
|
# Full CSV file |
|
|
|
apps = ScraperWiki.select("* from applications") |
|
|
|
|
|
|
|
csv_string = CSV.generate do |csv| |
|
|
|
csv << apps.first.keys # header row |
|
|
|
apps.each { |app| csv << app.values } |
|
|
|
end |
|
|
|
|
|
|
|
write_csv('.', 'inlink-full', csv_string) |
|
|
|
end |
|
|
|
|
|
|
|
def gen_new |
|
|
|
apps = ScraperWiki.select("* from `applications` order by date_received desc limit 30") |
|
|
|