diff options
author | Frederick Yin <fkfd@fkfd.me> | 2021-10-20 15:42:54 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2021-10-20 15:42:54 +0800 |
commit | e6e8e5e2388c54d1e177d6e72f37aa37a79cb75f (patch) | |
tree | 00322c2be5a18c727f62af6821eb1739e8e3d0ef | |
parent | fa3f7bad8a21e83618cf528db4c38bbfbdb5d7ad (diff) |
Adjust Flask server to new database methods
-rw-r--r-- | jimbrella/web.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/jimbrella/web.py b/jimbrella/web.py index 006c66c..8b45309 100644 --- a/jimbrella/web.py +++ b/jimbrella/web.py @@ -1,6 +1,5 @@ from flask import Flask, request, render_template from .database import Database -from .utils import group_by_status, find_overdue from .config import * db = Database(DATABASE_PATH) @@ -8,16 +7,16 @@ db = Database(DATABASE_PATH) app = Flask("jimbrella") -@app.route("/") +@app.route("/admin") def index(): umbrellas = db.read() - statuses = group_by_status(umbrellas) + statuses = Database.group_by_status(umbrellas) return render_template( - "index.html", - total=len(umbrellas), - available=len(statuses["available"]), - lent=len(statuses["lent"]), - overdue=len(find_overdue(umbrellas)), + "admin/index.html", + umbrellas=umbrellas, + available=statuses["available"], + lent=statuses["lent"], + overdue=Database.find_overdue(statuses["lent"]), ) |