Compare commits
No commits in common. "8c0c6133925a1333a3821211c63a5f3ffd7aa582" and "c4ba5ea1970178b9e19c5b7485f91e8ea030603a" have entirely different histories.
8c0c613392
...
c4ba5ea197
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,5 @@
|
|||
notes.txt
|
||||
.env
|
||||
.env.bak
|
||||
.vscode
|
||||
|
||||
*.pyc
|
||||
|
|
|
@ -199,14 +199,6 @@ def create():
|
|||
capacity_avaliable = current_app.config["HUB_MODEL"].capacity_avaliable(512*1024*1024)
|
||||
errors = list()
|
||||
|
||||
affordable_vm_sizes = dict()
|
||||
for key, vm_size in vm_sizes.items():
|
||||
# if a user deposits $7.50 and then creates an f1-s vm which costs 7.50 a month,
|
||||
# then they have to delete the vm and re-create it, they will not be able to, they will have to pay again.
|
||||
# so for UX it makes a lot of sense to give a small margin of 25 cents for usability sake
|
||||
if vm_size["dollars_per_month"] <= account_balance+0.25:
|
||||
affordable_vm_sizes[key] = vm_size
|
||||
|
||||
if request.method == "POST":
|
||||
if "csrf-token" not in request.form or request.form['csrf-token'] != session['csrf-token']:
|
||||
return abort(418, f"u want tea")
|
||||
|
@ -217,8 +209,6 @@ def create():
|
|||
errors.append("Size is required")
|
||||
elif size not in vm_sizes:
|
||||
errors.append(f"Invalid size {size}")
|
||||
elif size not in affordable_vm_sizes:
|
||||
errors.append(f"Your account must have enough credit to run an {size} for 1 month before you will be allowed to create it")
|
||||
|
||||
if not os:
|
||||
errors.append("OS is required")
|
||||
|
@ -270,6 +260,13 @@ def create():
|
|||
|
||||
return redirect(f"{url_for('console.index')}?created={id}")
|
||||
|
||||
affordable_vm_sizes = dict()
|
||||
for key, vm_size in vm_sizes.items():
|
||||
# if a user deposits $7.50 and then creates an f1-s vm which costs 7.50 a month,
|
||||
# then they have to delete the vm and re-create it, they will not be able to, they will have to pay again.
|
||||
# so for UX it makes a lot of sense to give a small margin of 25 cents for usability sake
|
||||
if vm_size["dollars_per_month"] <= account_balance+0.25:
|
||||
affordable_vm_sizes[key] = vm_size
|
||||
|
||||
for error in errors:
|
||||
flash(error)
|
||||
|
|
Loading…
Reference in New Issue
Block a user