Use arguments rather than passing around a dict

This makes it harder to write code which will pass tests but fail in
real life.
This commit is contained in:
Chris Hill-Scott
2021-03-11 10:52:03 +00:00
parent fce4082fff
commit 25a6788d66
4 changed files with 37 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
from datetime import datetime, timedelta
from flask import jsonify
from flask import render_template
from app import performance_dashboard_api_client
from app.main import main
@@ -8,10 +8,11 @@ from app.main import main
@main.route("/performance")
def performance():
api_args = {}
api_args['start_date'] = (datetime.utcnow() - timedelta(days=90)).date()
api_args['end_date'] = datetime.utcnow().date()
stats = performance_dashboard_api_client.get_performance_dashboard_stats(api_args)
return jsonify(stats)
stats = performance_dashboard_api_client.get_performance_dashboard_stats(
start_date=(datetime.utcnow() - timedelta(days=90)).date(),
end_date=datetime.utcnow().date(),
)
return render_template(
'views/performance.html',
**stats
)