Example #1
0
 def change_username(self,user_id,username):
     if (UserDAO().username_not_taken(username,user_id)):
         if (len(username) < 2):
             return 'must be at least 2 characters'
         else:
             return UserDAO().change_username(user_id, username)
     else:
         return 'Username has been taken'
Example #2
0
 def vote_Puzzle_Action(self,vote,user_id,puzzleid,action):
     hasvoted = UserDAO().has_user_voted(puzzleid,user_id)
     if hasvoted and action=='remove':
         UserDAO().delete_vote_user(user_id,puzzleid)
         return {'votes': GameDAO().get_likes_game(puzzleid)}
     elif not hasvoted and action=='create':
         UserDAO().insert_vote_user(vote,user_id,puzzleid)
         return {'votes': GameDAO().get_likes_game(puzzleid)}
     else:
         return {'votes': 'wrong request parameters for Voting in UserService.vote_Puzzle_Action'}
 def get_wc_highscores(self, wc_id):
     userlist = WC_DAO().get_wc_winners()
     highscores = WC_DAO().get_wc_highscores(wc_id)
     highscoreslist = list()
     for score in highscores:
         if score['logintype'] != 'anon':
             if userlist.get(score['user_id']) != None:
                 score['wins'] = userlist[score['user_id']]
             else:
                 score['wins'] = 0
             highscoreslist.append({
                 **score,
                 **UserDAO().get_user_metadata(score['user_id'])
             })
         else:
             highscoreslist.append({
                 **score,
                 **UserDAO().get_user_metadata(score['user_id'])
             })
     return highscoreslist
Example #4
0
 def get_highscores(self, uri, metadata=True):
     row = GameDAO().get_game_uri(uri)
     game = Game(row[0], row[1], row[2], row[3], row[4], row[5], row[6],
                 row[7])
     highscores = GameDAO().get_highscores(game.id)
     if metadata:
         newhighscores = list()
         for highscore in highscores:
             metadata = UserDAO().get_user_metadata(highscore['userid'])
             newhighscores.append({**highscore, **metadata})
         return newhighscores
     else:
         return highscores
Example #5
0
 def get_user(self,userID):
     return UserDAO().get_user(userID)
Example #6
0
 def delete_user(self,userID):
     return UserDAO().delete_user(userID)
Example #7
0
 def insert_user(self,username,logintype, accountID, profilePicture, email, activeFlag):
     return UserDAO().insert_user(username,logintype, accountID, profilePicture, email, activeFlag)
Example #8
0
 def get_user_by_logintype(self,accountID,logintype):
     return UserDAO().get_user_by_logintype(accountID,logintype)
Example #9
0
 def change_name(self, user_id, username):
     return UserDAO().change_username(user_id, username)
Example #10
0
 def get_user_puzzlerush_view(self,userID):
     return UserDAO().get_user_puzzlerush_view(userID)
Example #11
0
 def get_user_solutions_view(self,userID):
     return UserDAO().get_user_solutions_view(userID)
Example #12
0
 def get_user_games_view(self,userID):
     return UserDAO().get_user_games_view(userID)
Example #13
0
 def change_settings(self,userID, LineDir):
     return UserDAO().change_settings(userID,LineDir)