Ejemplo n.º 1
0
def sendUserData():
    if request.method == 'GET':
        return "You did not fill out the form!"
    else:
        global collegename, tuition, fullName, gradMonth, gradYear, currentMonth, currentYear, weeksleft, saving
        userInfo = dict(request.form)
        collegename = userInfo["collegename"]
        tuition = userInfo["tuition"]
        fullName = userInfo["fullName"]
        gradMonth = userInfo["gradMonth"]
        gradYear = userInfo["gradYear"]
        currentMonth = userInfo["currentMonth"]
        currentYear = userInfo["currentYear"]
        weeksleft = model.weeksLeft(gradYear, gradMonth, currentYear,
                                    currentMonth)
        saving = model.equation(weeksleft, tuition)
        schoolinfo = mongo.db.schoolinfo
        schoolinfo.insert({
            'collegename': collegename,
            'tuition': int(tuition),
            'gradYear': int(gradYear)
        })
        users = mongo.db.users
        users.insert({
            'fullName': fullName,
            'gradMonth': gradMonth,
            'gradYear': gradYear,
            'currentMonth': currentMonth,
            'currentYear': currentYear,
            'weeksleft': weeksleft,
            'saving': saving
        })
        return render_template("amount.html",
                               collegename=collegename,
                               tuition=tuition,
                               gradMonth=gradMonth,
                               gradYear=gradYear,
                               currentMonth=currentMonth,
                               currentYear=currentYear,
                               weeksleft=weeksleft,
                               saving=saving,
                               fullName=fullName)
Ejemplo n.º 2
0
def aid():
    if request.method == 'GET':
        return "You did not fill out the form!"
    else:
        newContribution = dict(request.form)
        contribution = newContribution["contribution"]
        print("Contribution = " + contribution)
        weeksleft = model.weeksLeft(gradYear, gradMonth, currentYear,
                                    currentMonth)
        extraMoney = model.neededAid(tuition, weeksleft, contribution)
        return render_template("newCost.html",
                               collegename=collegename,
                               tuition=tuition,
                               gradMonth=gradMonth,
                               gradYear=gradYear,
                               currentMonth=currentMonth,
                               currentYear=currentYear,
                               weeksleft=weeksleft,
                               contribution=contribution,
                               extraMoney=extraMoney)