Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FINALLY FINISHED

  • Loading branch information...
commit bc1c3205b804aeb13f962a63ee6dd10b65e88456 1 parent a4e0b0e
@briantotheyanyan briantotheyanyan authored
View
23 GROUP_6/project/app.py
@@ -11,6 +11,7 @@
@app.route("/",methods = ['get','post'])
def login():
+ global groupsize
global currentCounter
global MembersofGroup
global email
@@ -21,10 +22,12 @@ def login():
button = request.form['button']
if button == 'Rate':
+ print "HI"
email = request.form["username"]
if storage.checkUser(email)==True:
IDList = storage.getInfo(email)
MembersofGroup = storage.returnGroupList(email)
+ groupsize = len(MembersofGroup)
currentCounter = 0
return redirect(url_for("rate"))
else:
@@ -63,26 +66,24 @@ def rate():
global IDList
global MembersofGroup
global currentCounter
- groupsize = len(MembersofGroup)
+ global groupsize
if request.method == 'GET':
return render_template('RatingPage.html',currentRatee =storage.getInfo( MembersofGroup[currentCounter])[0])
else:
if request.form["button"] == "Rate":
- currentCounter = currentCounter + 1
- if currentCounter < groupSize:
- r1 = str(request.form["rating1"])
- r2 = str(request.form["rating2"])
- r3 = str(request.form["rating3"])
- r4 = str(request.form["rating4"])
- comment = str(request.form["comment"])
- return redirect(url_for('rate',currentRatee =storage.getInfo( MembersofGroup[currentCounter])[0]))
- else:
+
r1 = str(request.form["rating1"])
r2 = str(request.form["rating2"])
r3 = str(request.form["rating3"])
r4 = str(request.form["rating4"])
comment = str(request.form["comment"])
- return redirect(url_for('Success'))
+ storage.addRating(email,storage.getInfo( MembersofGroup[currentCounter])[0],r1,r2,r3,r4,comment)
+ currentCounter = currentCounter+1
+ if currentCounter < groupsize:
+ return redirect(url_for('rate',currentRatee =storage.getInfo( MembersofGroup[currentCounter])[0]))
+
+ else:
+ return redirect(url_for('Success'))
@app.route("/Success")
def Success():
View
58 GROUP_6/project/app.py~
@@ -11,6 +11,8 @@ app.secret_key = 'some_secret'
@app.route("/",methods = ['get','post'])
def login():
+ global currentCounter
+ global MembersofGroup
global email
global IDList
if request.method=='GET':
@@ -19,9 +21,12 @@ def login():
button = request.form['button']
if button == 'Rate':
+ print "HI"
email = request.form["username"]
if storage.checkUser(email)==True:
IDList = storage.getInfo(email)
+ MembersofGroup = storage.returnGroupList(email)
+ currentCounter = 0
return redirect(url_for("rate"))
else:
return redirect(url_for("page_not_found"))
@@ -29,6 +34,8 @@ def login():
email = request.form["username"]
if storage.checkUser(email)==True:
IDList = storage.getInfo(email)
+ MembersofGroup = storage.returnGroupList(email)
+ currentCounter = 0
return redirect(url_for("viewRates"))
else:
return redirect(url_for("page_not_found"))
@@ -37,41 +44,54 @@ def login():
@app.route('/fail')
def page_not_found():
+ global currentCounter
+ global MembersofGroup
global email
global IDList
return render_template("Fail.html")
@app.route('/view')
def viewRates():
+ global currentCounter
+ global MembersofGroup
global email
global IDList
return render_template("ViewRatings.html",info=IDList)
-@app.route('/Rater',methods=['get'])
+@app.route('/Rater',methods=['GET','POST'])
def rate():
global email
global IDList
- if request.method=='GET':
- return render_template('RatingPage.html',username=email)
+ global MembersofGroup
+ global currentCounter
+ groupsize = len(MembersofGroup)
+ if request.method == 'GET':
+ return render_template('RatingPage.html',currentRatee =storage.getInfo( MembersofGroup[currentCounter])[0])
else:
- return redirect(url_for('login'))
-
-'''
-def getRatings(email):
- return storage.s['id',email]
+ if request.form["button"] == "Rate":
+ if currentCounter < groupSize:
+ r1 = str(request.form["rating1"])
+ r2 = str(request.form["rating2"])
+ r3 = str(request.form["rating3"])
+ r4 = str(request.form["rating4"])
+ comment = str(request.form["comment"])
+ storage.add(email,getInfo( MembersofGroup[currentCounter])[0],r1,r2,r3,r4,comment)
+ currentCounter = currentCounter+1
+ return redirect(url_for('rate',currentRatee =storage.getInfo( MembersofGroup[currentCounter])[0]))
+ else:
+ r1 = str(request.form["rating1"])
+ r2 = str(request.form["rating2"])
+ r3 = str(request.form["rating3"])
+ r4 = str(request.form["rating4"])
+ comment = str(request.form["comment"])
+ storage.add(email,getInfo( MembersofGroup[currentCounter])[0],r1,r2,r3,r4,comment)
+
+ return redirect(url_for('Success'))
-def rate(email,r1,r2,r3,comment):
- storage.s['responses',email,1] = r1
- storage.s['responses',email,2] = r2
- storage.s['responses',email,3] = r3
- storage.s['responses',email,4] = comment
+@app.route("/Success")
+def Success():
+ return render_template("Success.html")
-def getInfo(email):
- namesList =[]
- namesList[1] = storage.s[email,firstName]
- namesList.append(storage.s[email,lastName])
-'''
-
if __name__=="__main__":
app.debug=True
app.run()
View
BIN  GROUP_6/project/info.dat.db
Binary file not shown
View
BIN  GROUP_6/project/storage.pyc
Binary file not shown
View
4 GROUP_6/project/templates/RatingPage.html
@@ -23,7 +23,7 @@ <h1 style=text-align:center;font-family:arial;>RATER!</h1>
<div id="content" style="background-color:#EEEEEE;height:200px;width:500px;float:left;">
<p </p>
-<form name="input" action="html_form_action.asp" method="get">
+<form name="input" form action = "" method="post">
<center><p style=font-family:arial;>How knowledgable a partner was this person?<center>
@@ -78,4 +78,4 @@ <h1 style=text-align:center;font-family:arial;>RATER!</h1>
<input type=radio name="rating4" value="9">9<p>
<textarea name="comment" cols="50" rows="3">Enter comments here...</textarea> <br>
<input type="submit" name = "button" value ="Rate"><p style=font-family:arial;>
-</form>
+</form>
Please sign in to comment.
Something went wrong with that request. Please try again.