Example #1
0
def survey():
    if request.method=="GET":
        if 'user' not in session:
            return redirect(url_for("login"))
        return render_template("survey.html", surveynames = util.getSurveyNames())
    else:
        if request.form.has_key("tablogin"):
            return redirect(url_for("login"))
        if request.form.has_key("tabhome"):
            return redirect(url_for("home"))
        if request.form.has_key("tabsignup"):
            return redirect(url_for("signup"))
        if request.form.has_key("tabcreate"):
            return redirect(url_for("create"))
        if request.form.has_key("tabprofile"):
            return redirect(url_for("myprofile"))
        if request.form.has_key("tabsurvey"):
            return redirect(url_for("survey"))
        if request.form.has_key("tabresults"):
            return redirect(url_for("results"))
        if request.form.has_key("submitSurvey"):
            sname = request.form['sname']
            username = session['user']
            ans = []
            #change to correct question number
            for i in range (0, 5):
                ans.append(request.form[str(i)])
            print sname, username, ans    
            util.takeSurvey(sname, username, ans)
            return redirect(url_for("results"))
Example #2
0
def submitSurvey():
    surveyname = request.args.get('surveyname', '')
    ans = request.args.get('ans', '').split(",")
    username = session['user']
    print surveyname, ans, username
    return util.takeSurvey(surveyname, username, ans)
Example #3
0
def submitSurvey():
    surveyname = request.args.get("surveyname", "")
    ans = request.args.get("ans", "").split(",")
    username = session["user"]
    print surveyname, ans, username
    return util.takeSurvey(surveyname, username, ans)