Update model
This commit is contained in:
parent
3174465be2
commit
f140df2146
11
model.py
11
model.py
@ -108,12 +108,15 @@ class Model(object):
|
||||
raise Exception("No such user")
|
||||
|
||||
@ApiMethod
|
||||
async def set_max_score(self, authtoken, newmaxscore):
|
||||
async def set_max_score(self, authtoken, uuid, newmaxscore):
|
||||
self.verify_admin(authtoken)
|
||||
if newscore <= user.maxscore:
|
||||
user.score = newscore
|
||||
if uuid not in self.users:
|
||||
raise Exception("No such user")
|
||||
user = self.users[uuid]
|
||||
if newmaxscore < user.maxscore:
|
||||
raise Exception("Tried to lower maxscore. That's bad...")
|
||||
else:
|
||||
raise Exception("Tried to raise user score above maxscore")
|
||||
user.maxscore = newmaxscore
|
||||
|
||||
class User:
|
||||
|
||||
|
@ -4,35 +4,35 @@
|
||||
"uuid": "u4zhlm4y2w4alg4adpj3amw67ivhtfbx",
|
||||
"name": "Andi",
|
||||
"score": 78,
|
||||
"maxscore": 100,
|
||||
"maxscore": 125,
|
||||
"timeout": 0
|
||||
},
|
||||
"bd63gy2wfdk72q3mk6ooesanx4mo33ao": {
|
||||
"uuid": "bd63gy2wfdk72q3mk6ooesanx4mo33ao",
|
||||
"name": "Felix",
|
||||
"score": 52,
|
||||
"maxscore": 75,
|
||||
"score": 276,
|
||||
"maxscore": 300,
|
||||
"timeout": 0
|
||||
},
|
||||
"5wn24yko36muqoxohczbf53i6p3hx2pa": {
|
||||
"uuid": "5wn24yko36muqoxohczbf53i6p3hx2pa",
|
||||
"name": "Daki",
|
||||
"score": 62,
|
||||
"maxscore": 100,
|
||||
"maxscore": 125,
|
||||
"timeout": 0
|
||||
},
|
||||
"iz2z4c5wkxldc2vdjh66zubxcsvb5qjs": {
|
||||
"uuid": "iz2z4c5wkxldc2vdjh66zubxcsvb5qjs",
|
||||
"name": "Cindy",
|
||||
"score": 91,
|
||||
"maxscore": 100,
|
||||
"score": 100,
|
||||
"maxscore": 200,
|
||||
"timeout": 0
|
||||
},
|
||||
"pfkkuzo4y2tmopgc5o6n6zvhy7dyvqdy": {
|
||||
"uuid": "pfkkuzo4y2tmopgc5o6n6zvhy7dyvqdy",
|
||||
"name": "Dominik",
|
||||
"score": 46,
|
||||
"maxscore": 50,
|
||||
"maxscore": 150,
|
||||
"timeout": 0
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user