Ejemplo n.º 1
0
def updateRating(username, userRating, qK, qRating, result):
    user = User.all().filter("username =", username).get()
    question = Question.get(qK)
    user.rating, question.rating = getNewRatings(userRating, qRating, result)
    user.put()
    question.put()
    return str(user.rating)
Ejemplo n.º 2
0
def voteQuestion(up, key):  # up=1 down=0 that's "up?"
    question = Question.get(key)
    if up:
        question.votes += 1
    else:
        question.votes -= 1
    if question.votes < -10:
        db.delete(key)
        getQuestionKeys(update=True)
    else:
        question.put()