예제 #1
0
def running(city, tour, tour1, stage, hidden):
    newstage = db.getUser(getUser())[0][5]
    points = db.getUser(session["user"])[0][3]
    print newstage
    stages = len(db.getTour(tour)[0][2]) - 1
    if newstage == "Begin":
        newstage = 0
    if int(newstage) == stages + 1:
        newstage = "End"
    if newstage == "End":
        return redirect("complete")
    newstage = int(newstage)
    clue = db.getTour(tour)[0][2][newstage]
    hint = db.getTour(tour)[0][3][newstage]
    latitude = db.getTour(tour)[0][5][newstage][0]
    print latitude
    longitude = db.getTour(tour)[0][5][newstage][1]
    # hint = db.getTour(tour)[0][3][newstage]
    print db.getUser(getUser())[0][5]
    if request.method == "POST":
        if request.form.has_key("hint"):
            db.editPoints(getUser(),-2)
            hidden = "False"
            sstage = str(newstage)
            return redirect("/"+city+"/"+tour+"/"+tour1+"/"+sstage+"/"+hidden)
        else:
            db.goToNextStage(getUser(),tour)
            print db.getUser(getUser())[0][5]
            sstage = str(db.getUser(getUser())[0][5])
            hidden = "True"
            return  redirect("/"+city+"/"+tour+"/"+tour1+"/"+sstage+"/"+hidden)
    return render_template('runningtour.html', city=city, tour=tour, stage=newstage, hidden=hidden, clue = clue, stages = stages, latitude = latitude, longitude = longitude, points = points, title = tour, hint = hint)
예제 #2
0
def complete():
    if "user" in session:
        tour = db.getUser(getUser())[0][4]
        stages = len(db.getTour(tour)[0][2])
        db.editPoints(getUser(),stages*5)
        points = db.getUser(session["user"])[0][3]
        db.addCurrentTourtoUser(getUser(),"None")
        return render_template("complete.html", points=points, epoints=(stages*5))
    return redirect(url_for("index"))