Configure time with URL
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
kleph 2020-02-20 02:23:04 +01:00
parent 804019a0dc
commit 543b9c7260
2 changed files with 11 additions and 5 deletions

12
beer.py
View file

@ -3,16 +3,22 @@
""" stupid countdown beer app to amuse my colleagues and collect buzzwords """
from flask import Flask
from flask import render_template
# pylint: disable=invalid-name
app = Flask(__name__)
@app.route('/')
def index():
@app.route('/<int(min=0, max=23):hours>/<int(min=0, max=59):minutes>')
def index(hours=None, minutes=None):
""" main and only app """
with open('static/beer.html') as html_file:
data = html_file.read()
if not hours:
hours = 17
if not minutes:
minutes = 0
data = render_template('beer.html', hours=hours, minutes=minutes)
return data

View file

@ -52,7 +52,7 @@ var x = setInterval(function() {
// var now = new Date().getTime();
var now = new Date().getTime();
var today = new Date();
today.setHours(17, 00);
today.setHours( {{ hours }}, {{ minutes }});
var goal = today.getTime();
// Find the distance between now and the count down date