This commit is contained in:
parent
804019a0dc
commit
543b9c7260
2 changed files with 11 additions and 5 deletions
12
beer.py
12
beer.py
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
Loading…
Reference in a new issue