check_if_shortterm_flag_can_be_unset on capsul deletion
This commit is contained in:
parent
a177418268
commit
4b54aa4075
@ -18,7 +18,7 @@ from capsulflask.metrics import durations as metric_durations
|
|||||||
from capsulflask.auth import account_required
|
from capsulflask.auth import account_required
|
||||||
from capsulflask.db import get_model
|
from capsulflask.db import get_model
|
||||||
from capsulflask.shared import my_exec_info_message, get_vm_months_float, get_account_balance, average_number_of_days_in_a_month
|
from capsulflask.shared import my_exec_info_message, get_vm_months_float, get_account_balance, average_number_of_days_in_a_month
|
||||||
from capsulflask.payment import poll_btcpay_session
|
from capsulflask.payment import poll_btcpay_session, check_if_shortterm_flag_can_be_unset
|
||||||
from capsulflask import cli
|
from capsulflask import cli
|
||||||
|
|
||||||
bp = Blueprint("console", __name__, url_prefix="/console")
|
bp = Blueprint("console", __name__, url_prefix="/console")
|
||||||
@ -140,6 +140,10 @@ def detail(id):
|
|||||||
current_app.config["HUB_MODEL"].destroy(email=session['account'], id=id)
|
current_app.config["HUB_MODEL"].destroy(email=session['account'], id=id)
|
||||||
get_model().delete_vm(email=session['account'], id=id)
|
get_model().delete_vm(email=session['account'], id=id)
|
||||||
|
|
||||||
|
# now that the user has 1 less vm, check if thier account can fund all thier vms for
|
||||||
|
# 1 month and if so, set all thier vms to longterm
|
||||||
|
check_if_shortterm_flag_can_be_unset(session['account'])
|
||||||
|
|
||||||
return render_template("capsul-detail.html", vm=vm, deleted=True)
|
return render_template("capsul-detail.html", vm=vm, deleted=True)
|
||||||
elif request.form['action'] == "force-stop":
|
elif request.form['action'] == "force-stop":
|
||||||
if 'are_you_sure' not in request.form or not request.form['are_you_sure']:
|
if 'are_you_sure' not in request.form or not request.form['are_you_sure']:
|
||||||
|
Loading…
Reference in New Issue
Block a user