Exemplo n.º 1
0
def addHintScore(username=None):
    if username is None:
        return 1
    else:
        session = db.createSession()
        status = db.updateScore(session, scoreIncrement, username, "hintScore")
        return status
Exemplo n.º 2
0
def getLeaderboard():
    session = db.createSession()
    lb = db.retrieveLeaderboard(session)
    fulldict = dict()
    for row in lb:
        nickname = row[0]
        rowdict = dict()
        rowdict['guessScore'] = row[1]
        rowdict['hintScore'] = row[2]
        rowdict['totScore'] = row[3]

        fulldict[nickname] = rowdict

    results = json.loads(fulldict)
    return results 
Exemplo n.º 3
0
import db_util as db
import uuid

session = db.createSession()

print(session)

login_info = {
    'dob': '1999-03-02',
    'firstname': 'Mark',
    'lastname': 'Test',
    'nickname': 'RapidBadger'
}

#s1 = db.insertNickname(session, login_info)
print("s2")
s2 = db.retrieveLeaderboard(session)
for row in s2:
    print (row[0], row[1], row[2], row[3])
print("s3")
s3 = db.getUseridFromNickname(session, login_info['nickname'])
print(s3)
print("s4")
s4 = db.updateScore(session, 40, s3, "guessscore")
Exemplo n.º 4
0
def resetLeaderboard():
    session = db.createSession()
    status = db.resetScores(session)
    return status