make update script quiet

This commit is contained in:
nein.wtf 2022-02-21 22:20:54 +01:00
commit 384fcad395
3 changed files with 15 additions and 7 deletions

View file

@ -1,6 +1,8 @@
sqlite3 = require "lsqlite3"
db = sqlite3.open('covid_deaths.db')
db = sqlite3.open('covid_deaths.db', sqlite3.OPEN_READONLY)
SetStatus(200)
SetHeader('Content-Type', 'text/html; charset=utf-8')
Write([[
<!doctype html>
<html>
@ -14,6 +16,10 @@ Write([[
padding: 48px;
font-family: sans-serif;
color: #222;
word-break: break-all;
}
p {
word-break: normal;
}
span.last-update {
color: #999;
@ -50,12 +56,12 @@ function format_int(number)
end
local deaths_yesterday = rows[1]["sum_deaths"] - rows[2]["sum_deaths"]
local description = format_int(rows[1]["sum_deaths"]) .. ' people died from Covid-19. ' .. format_int(deaths_yesterday) .. ' died within the last day.'
Write('<p>' .. description .. ' <span class="last-update">Last update: ' .. rows[1]["last_update"] .. ' UTC</span></p>')
local description = format_int(rows[1]["sum_deaths"]) .. ' people died from Covid-19. ' .. format_int(deaths_yesterday) .. ' died within the last day. '
Write('<p>' .. description .. ' <span class="last-update">Last update: ' .. rows[1]["last_update"] .. ' UTC (<a href="https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data" target="_blank">Source</a>)</span></p>')
Write('<span class="count">')
for i=1,rows[1]["sum_deaths"] do
Write('🖤')
Write('')
if i > 0 and i < rows[1]["sum_deaths"] and i % 100 == 0 then
Write('</span><span class="count">')
end