forked from 3wordchant/capsul-flask
implement bill for at least 24 hours
This commit is contained in:
parent
4f002458b3
commit
4b169e9886
@ -45,7 +45,7 @@ def double_check_capsul_address(id, ipv4):
|
||||
def index():
|
||||
vms = get_vms()
|
||||
created = request.args.get('created')
|
||||
|
||||
|
||||
# this is here to prevent xss
|
||||
if not re.match(r"^(cvm|capsul)-[a-z0-9]{10}$", created):
|
||||
created = '___________'
|
||||
@ -274,7 +274,10 @@ def get_account_balance(vms, payments, as_of):
|
||||
vm_cost_dollars = 0.0
|
||||
for vm in vms:
|
||||
end_datetime = vm["deleted"] if vm["deleted"] else as_of
|
||||
vm_months = ( end_datetime - vm["created"] ).days / average_number_of_days_in_a_month
|
||||
days = float((end_datetime - vm["created"]).total_seconds())/float(60*60*24)
|
||||
if days < 1:
|
||||
days = float(1)
|
||||
vm_months = days / average_number_of_days_in_a_month
|
||||
vm_cost_dollars += vm_months * float(vm["dollars_per_month"])
|
||||
|
||||
payment_dollars_total = float( sum(map(lambda x: 0 if x["invalidated"] else x["dollars"], payments)) )
|
||||
|
@ -25,7 +25,7 @@
|
||||
<pre>
|
||||
CAPSUL SIZES
|
||||
============
|
||||
type monthly cpus mem ssd net*
|
||||
type monthly* cpus mem ssd net*
|
||||
----- ------- ---- --- --- ---
|
||||
f1-s $5.33 1 512M 25G .5TB
|
||||
f1-m $7.16 1 1024M 25G 1TB
|
||||
@ -35,6 +35,7 @@
|
||||
f1-xxx $57.58 8 16G 25G 16TB
|
||||
|
||||
* net is calculated as a per-month average
|
||||
* vms are billed for a minimum of 24 hours upon creation
|
||||
* all VMs come standard with one public IPv4 addr</pre>
|
||||
<pre>
|
||||
Your <a href="/console/account-balance">account balance</a>: ${{ account_balance }}
|
||||
|
Loading…
Reference in New Issue
Block a user