|
|
@@ -6,7 +6,8 @@ class Site |
|
|
|
def self.generate |
|
|
|
# Home page |
|
|
|
summary = ScraperWiki.select(" |
|
|
|
authority_name, status, decision, appeal_status, appeal_decision, count(*) as applications |
|
|
|
authority_name, status, decision, appeal_status, appeal_decision, |
|
|
|
count(*) as applications |
|
|
|
from applications |
|
|
|
group by authority_name, status, decision, appeal_status, appeal_decision |
|
|
|
") |
|
|
@@ -20,15 +21,18 @@ class Site |
|
|
|
last_updated = DateTime.parse(q[0]['scraped_at']) |
|
|
|
|
|
|
|
path = '.' |
|
|
|
Petrify.page(path, 'index', { summary: summary, last_updated: last_updated }) |
|
|
|
Petrify.page(path, 'index', \ |
|
|
|
{ summary: summary, last_updated: last_updated }) |
|
|
|
Petrify.csv(path, 'inlink-summary', summary) |
|
|
|
|
|
|
|
# New applications page |
|
|
|
apps = ScraperWiki.select("* from `applications` order by date_received desc limit 60") |
|
|
|
apps = ScraperWiki.select("* from `applications` |
|
|
|
order by date_received desc limit 60") |
|
|
|
Petrify.page('new-applications', 'new-applications', { apps: apps }) |
|
|
|
|
|
|
|
# Latest decisions page |
|
|
|
apps = ScraperWiki.select("* from `applications` order by date_decision desc limit 60") |
|
|
|
apps = ScraperWiki.select("* from `applications` |
|
|
|
order by date_decision desc limit 60") |
|
|
|
path = 'decisions' |
|
|
|
Petrify.page(path, 'decisions', { apps: apps }) |
|
|
|
Petrify.csv(path, 'inlink-decisions', apps) |
|
|
@@ -61,7 +65,8 @@ class Site |
|
|
|
Petrify.page('media', 'media', { stories: stories }) |
|
|
|
|
|
|
|
# Authority pages |
|
|
|
auths = ScraperWiki.select("distinct(authority_name) as authority_name from applications") |
|
|
|
auths = ScraperWiki.select("distinct(authority_name) as authority_name |
|
|
|
from applications") |
|
|
|
|
|
|
|
auths.each do |auth| |
|
|
|
summary = ScraperWiki.select(" |
|
|
@@ -71,7 +76,8 @@ class Site |
|
|
|
group by status, decision, appeal_status, appeal_decision |
|
|
|
", auth['authority_name']) |
|
|
|
|
|
|
|
apps = ScraperWiki.select("* from applications where authority_name = ? order by date_received desc", auth['authority_name']) |
|
|
|
apps = ScraperWiki.select("* from applications where authority_name = ? |
|
|
|
order by date_received desc", auth['authority_name']) |
|
|
|
|
|
|
|
this_stories = stories.select \ |
|
|
|
{ |story| story['authorities'].match(auth['authority_name']) } |
|
|
|