def home(): u = User.query.filter_by(id=email).first(); bills = [0, 0, 0, 0, 0, 160.40, 195.23, 203.04, 161.86, 134.45] days = [3, 7, 10, 12, 16, 21, 34, 38, 42, 47, 50, 54, 58, 57, 62] monthGraph = monthly.makeGraph(u.id, days, u.monthly, u.maxlimit) yearGraph = yearly.makeGraph(u.id, bills) return render_template('home.html', monthly=u.monthly, maxlimit=u.maxlimit, monthGraph=monthGraph, yeartodate=yearGraph)
def setup(): if request.method == 'POST': bankAccount = request.form['account'] monthly = request.form['goal'] limit = request.form['max'] state = request.form['state'] acSize = request.form['size'] if acSize == 'empty': return render_template('setup.html', email=email, password=password) u = User(id='*****@*****.**', bankAccount=bankAccount, password='******', monthly=monthly, maxlimit=limit, state=state, acUnit=acSize) db.session.add(u) db.session.commit() u = User.query.filter_by(id=email).first(); bills = [0, 0, 0, 0, 0, 160.40, 195.23, 203.04, 161.86, 134.45] days = [3, 7, 10, 12, 16, 21, 34, 38, 42, 47, 50, 54, 58, 57, 62] monthGraph = monthly.makeGraph(u.id, days, u.monthly, u.maxlimit) yearGraph = yearly.makeGraph(u.id, bills) #conserveEnergy(email); return render_template('home.html', monthly=u.monthly, maxlimit=u.maxlimit, monthGraph=monthGraph, yeartodate=yearGraph) else: return render_template('index.html')
def login(): error = None if request.method == 'POST': email = request.form['username'] global password password = request.form['password'] if valid_login(email, password): if check_user_in_db(email): return render_template('setup.html') else: u = User.query.filter_by(id=email).first(); #conserverEnergy(); bills = [0, 0, 0, 0, 0, 160.40, 195.23, 203.04, 161.86, 134.45] days = [3, 7, 10, 12, 16, 21, 34, 38, 42, 47, 50, 54, 58, 57, 62] monthGraph = monthly.makeGraph(u.id, days, u.monthly, u.maxlimit) yearGraph = yearly.makeGraph(u.id, bills) return render_template('home.html', monthly=u.monthly, maxlimit=u.maxlimit, monthGraph=monthGraph, yeartodate = yearGraph) else: error = 'Invalid email/password' return render_template('index.html',error=error)