activate functions bugs

This commit is contained in:
deflax 2017-07-15 07:28:04 +03:00
parent 7bfdd479f2
commit f222aeae14
2 changed files with 6 additions and 4 deletions

View file

@ -5,7 +5,9 @@ from flask_sqlalchemy import get_debug_queries
from . import main
from .. import db
from ..email import send_email
from ..models import User, Permission, Deployment, Service, Region, Address, Domain
from ..models import User, Permission, Deployment, Service, Region, Address, Domain, contact_proxmaster
import base64
@main.after_app_request
def after_request(response):

View file

@ -143,7 +143,7 @@ def activate(itemid=0):
if current_user.wallet < total:
flash('Insufficient Funds')
return redirect(url_for('uinvoice.transactions'))
current_app.logger.info('[{}] Charge deployments: {}'.format(current_user.email, inventory))
current_app.logger.info('[{}] Charge deployment: {}'.format(current_user.email, deploy.machine_id))
today = datetime.utcnow()
current_app.logger.info(form.period.data)
@ -153,10 +153,10 @@ def activate(itemid=0):
deploy.period = form.period.data
deploy.daysleft = form.period.data * daysleft.days
deploy.warning = False
deploy.active = True
deploy.enabled = True
db.session.commit()
transaction = Transaction(user_id=int(current_user.pid), description='Deployment {} activated for {} month(s)', value=-total)
transaction = Transaction(user_id=int(current_user.pid), description='Deployment {} activated for {} month(s)'.format(deploy.machine_alias, form.period.data), value=-total)
db.session.add(transaction)
db.session.commit()