Commit 15e57dca906f20ed704a55812bf7368381a64783
1 parent
03c194bf
Exists in
master
Naming things and invalidating the cache.
One commit, both the most difficult things.
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
flaskr/controllers/main_controller.py
... | ... | @@ -57,6 +57,20 @@ def estimate(): |
57 | 57 | return render_template("estimate.html", form=form) |
58 | 58 | |
59 | 59 | |
60 | +@main.route("/invalidate") | |
61 | +def invalidate(): | |
62 | + stuck_estimations = Estimation.query \ | |
63 | + .filter_by(status=StatusEnum.working) \ | |
64 | + .all() | |
65 | + | |
66 | + for estimation in stuck_estimations: | |
67 | + estimation.status = StatusEnum.failure | |
68 | + estimation.errors = "Invalidated. Try again." | |
69 | + db.session.commit() | |
70 | + | |
71 | + return "" | |
72 | + | |
73 | + | |
60 | 74 | @main.route("/compute") |
61 | 75 | def compute(): # process the queue of estimation requests |
62 | 76 | |
... | ... | @@ -298,6 +312,7 @@ def compute(): # process the queue of estimation requests |
298 | 312 | use_train_below=0, |
299 | 313 | ) |
300 | 314 | city_results['city'] = city_key |
315 | + city_results['address'] = destination.address | |
301 | 316 | results['cities'].append(city_results) |
302 | 317 | |
303 | 318 | # Todo: sort cities, and perhaps extract optimum | ... | ... |