Planning applications tracker for InLinkUK from BT kiosks. https://kiosks.adrianshort.org/
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

42 Zeilen
1.6 KiB

  1. require 'scraperwiki'
  2. class Site
  3. def self.generate
  4. # Home page
  5. summary = ScraperWiki.select("
  6. authority_name, status, decision, appeal_status, appeal_decision, count(*) as applications
  7. from applications
  8. group by authority_name, status, decision, appeal_status, appeal_decision
  9. ")
  10. Petrify.page('.', 'index', { summary: summary })
  11. # Summary CSV file
  12. Petrify.csv('.', 'inlink-summary', summary)
  13. # New applications page
  14. apps = ScraperWiki.select("* from `applications` order by date_received desc limit 30")
  15. Petrify.page('new-applications', 'new-applications', { apps: apps })
  16. # Latest decisions page
  17. apps = ScraperWiki.select("* from `applications` order by date_decision desc limit 30")
  18. Petrify.page('decisions', 'decisions', { apps: apps })
  19. # Page and CSV file for each authority
  20. auths = ScraperWiki.select("distinct(authority_name) as authority_name from applications")
  21. auths.each do |auth|
  22. summary = ScraperWiki.select("
  23. status, decision, appeal_status, appeal_decision, count(*) as qty
  24. from applications
  25. where authority_name = ?
  26. group by status, decision, appeal_status, appeal_decision
  27. ", auth['authority_name'])
  28. apps = ScraperWiki.select("* from applications where authority_name = ? order by date_received", auth['authority_name'])
  29. path = ['authorities', slug(auth['authority_name'])]
  30. Petrify.page(path, 'authority', { apps: apps, auth: auth, summary: summary })
  31. Petrify.csv(path, slug(auth['authority_name']), apps)
  32. end
  33. end
  34. end