From 1fdb34ab07f2f17dfadfc2570d4ca716289dd78f Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Sat, 13 Oct 2018 09:06:19 +0100 Subject: [PATCH] Add last updated timestamp to homepage --- lib/site.rb | 10 +++++++++- views/index.haml | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/site.rb b/lib/site.rb index 4310d97..25a1e2e 100644 --- a/lib/site.rb +++ b/lib/site.rb @@ -9,9 +9,17 @@ class Site from applications group by authority_name, status, decision, appeal_status, appeal_decision ") + + q = ScraperWiki.select(" + scraped_at + from applications + order by scraped_at desc + limit 1") + + last_updated = DateTime.parse(q[0]['scraped_at']) path = '.' - Petrify.page(path, 'index', { summary: summary }) + Petrify.page(path, 'index', { summary: summary, last_updated: last_updated }) Petrify.csv(path, 'inlink-summary', summary) # New applications page diff --git a/views/index.haml b/views/index.haml index e2652fe..5142127 100644 --- a/views/index.haml +++ b/views/index.haml @@ -1,5 +1,9 @@ %h1 Summary +%p + Last updated: + = last_updated.strftime("%d %B %Y at %l:%M%P") + %p.warning There are typically two applications per kiosk: one for full planning permission or telecoms prior approval, and one for advertisement consent. So the number of kiosks applied for is half the number of applications. %p= download_button('inlink-summary.csv')