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 """ """ stupid countdown beer app to amuse my colleagues and collect buzzwords """
from flask import Flask from flask import Flask
from flask import render_template
# pylint: disable=invalid-name # pylint: disable=invalid-name
app = Flask(__name__) app = Flask(__name__)
@app.route('/') @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 """ """ main and only app """
with open('static/beer.html') as html_file: if not hours:
data = html_file.read() hours = 17
if not minutes:
minutes = 0
data = render_template('beer.html', hours=hours, minutes=minutes)
return data return data

View file

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