Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added error message for contest restart, fixed permutation bug

  • Loading branch information...
commit 247a506e51f4e47591d3edc004855acfd05afd59 1 parent 6c623d0
@swvist authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 index.py
View
11 index.py
@@ -21,8 +21,12 @@ def get(self,var):
if not user:
self.redirect(users.create_login_url(self.request.uri))
else:
- userdb.userPlayStart(var)
- self.redirect('/?auth=1')
+ if not userdb.userPlayExist():
+ userdb.userPlayStart(var)
+ self.redirect('/?auth=1')
+ else:
+ self.response.headers['Content-Type'] = 'text/html'
+ self.response.out.write("You were not supposed to do this! <a href='/'>Retry Here</a>")
class contestStop(webapp.RequestHandler):
@@ -32,13 +36,14 @@ def get(self):
class contestQuestion(webapp.RequestHandler):
def get(self,var):
+ self.response.headers['Content-Type'] = 'application/json'
r = questiondb.getQuestion(int(userdb.userPermutation(int(var))))
self.response.out.write(r)
class contestAnswer(webapp.RequestHandler):
def get(self):
self.response.out.write(userdb.userAnswerSubmit(
- int(userdb.userReversePermutation(int(self.request.get('question')))),
+ int(userdb.userPermutation(int(self.request.get('question')))),
self.request.get('answer')))
class adminQuestionsAdd(webapp.RequestHandler):
Please sign in to comment.
Something went wrong with that request. Please try again.