|
|
@@ -3,14 +3,13 @@ require 'scraperwiki' |
|
|
|
class Site |
|
|
|
def self.generate |
|
|
|
# Home page |
|
|
|
path = '.' |
|
|
|
|
|
|
|
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 |
|
|
|
") |
|
|
|
|
|
|
|
path = '.' |
|
|
|
Petrify.page(path, 'index', { summary: summary }) |
|
|
|
Petrify.csv(path, 'inlink-summary', summary) |
|
|
|
|
|
|
@@ -23,8 +22,6 @@ class Site |
|
|
|
Petrify.page('decisions', 'decisions', { apps: apps }) |
|
|
|
|
|
|
|
# Appeals page |
|
|
|
path = 'appeals' |
|
|
|
|
|
|
|
summary = ScraperWiki.select(" |
|
|
|
authority_name, appeal_status, appeal_decision, count(*) as applications |
|
|
|
from applications |
|
|
@@ -39,6 +36,7 @@ class Site |
|
|
|
and appeal_status != 'Unknown' |
|
|
|
") |
|
|
|
|
|
|
|
path = 'appeals' |
|
|
|
Petrify.page(path, 'appeals', { summary: summary, apps: apps }) |
|
|
|
Petrify.csv(path, 'inlink-appeals', apps) |
|
|
|
|
|
|
@@ -46,8 +44,6 @@ class Site |
|
|
|
auths = ScraperWiki.select("distinct(authority_name) as authority_name from applications") |
|
|
|
|
|
|
|
auths.each do |auth| |
|
|
|
path = ['authorities', slug(auth['authority_name'])] |
|
|
|
|
|
|
|
summary = ScraperWiki.select(" |
|
|
|
status, decision, appeal_status, appeal_decision, count(*) as qty |
|
|
|
from applications |
|
|
@@ -57,6 +53,7 @@ class Site |
|
|
|
|
|
|
|
apps = ScraperWiki.select("* from applications where authority_name = ? order by date_received", auth['authority_name']) |
|
|
|
|
|
|
|
path = ['authorities', slug(auth['authority_name'])] |
|
|
|
Petrify.page(path, 'authority', { apps: apps, auth: auth, summary: summary }) |
|
|
|
Petrify.csv(path, slug(auth['authority_name']), apps) |
|
|
|
end |
|
|
|