def execute(self): with dbSession() as session: # check user interest was already set data = session.query(user_interest) \ .filter(user_interest.useridx == self.useridx) \ commander = dbCommander(data) values = commander.to_list() if len(values) == 0: new_data = user_interest(self.useridx, self.data) session.add(new_data) try: session.commit() except Exception as error: print(error) return # already user interest was set else: data[0].interest = self.data try: session.commit() print(data[0].interest) except Exception as error: print(error) return
def execute(self): friend_list = [] data = [] with cache.get_pipeline('sharding', 'Slave') as pipeline: try: pipeline.hgetall(str(self.useridx) + ':FriendList') friends = pipeline.execute() except Exception as error: print(error) for friend in friends: for key, value in friend.items(): if int(value) == E_Friend_Request_State.accepted: friend_list.append(int(key)) with dbSession() as session: query = session.query(user_account). \ filter(user_account.useridx != self.useridx). \ filter(user_account.useridx.notin_(friend_list))[:50]. \ all() for account in query: commander = dbCommander(account) data.append(commander.parsing()) return data
def execute(self): with dbSession() as session: query = session.query(user_account, user_interest) \ .filter(user_account.username == self.username) \ .filter(user_account.useridx == user_interest.useridx) \ .all() result = {} for account, interest in query: commander = dbCommander(account) account_values = commander.parsing() commander = dbCommander(interest) interest_values = commander.parsing() result['account'] = account_values result['interest'] = interest_values['interest'] return result
def execute(self): with dbSession() as session: query = session.query(user_character). \ filter(user_character.useridx == self.useridx). \ all() result = [] for character in query: commander = dbCommander(character) result.append(commander.parsing()) return result
def executeOnSession(self, session): query = session.query(user_equipment). \ filter(user_equipment.useridx == self.useridx). \ filter(user_equipment.characteridx == self.characteridx). \ all() equipment_list = [] for equipment in query: commander = dbCommander(equipment) equipment_list.append(commander.parsing()) return equipment_list
def execute(self): with dbSession() as session: query = session.query(user_account). \ all() userAccount_list = [] for account in query: commander = dbCommander(account) userAccount_list.append(commander.parsing()) for account in userAccount_list: print(account)
def execute(self): with dbSession() as session: data = session.query(user_interest) \ .filter(user_interest.useridx == self.useridx) commander = dbCommander(data) values = commander.to_list() result = {} if len(values) > 0: result = values[0]['interest'] for i in result: print(result[i]) return result
def execute(self): with dbSession() as session: query = session.query(user_character). \ filter(user_character.useridx == self.useridx). \ filter(user_character == self.characteridx). \ all() result = [] for character in query: commander = dbCommander(character) result.append(commander.parsing()) from WebApplication.Logic.DB.User.Equipment import sp_readEquipment sp = sp_readEquipment(self.useridx, self.characteridx) equipment_list = sp.executeOnSession(session) return result, equipment_list
def execute(self): with dbSession() as session: query = session.query(user_account). \ filter(user_account.username == self.username, user_account.password == self.password) commander = dbCommander(query) values = commander.to_list() if len(values) == 0: return 0 else: # update login date query[0].login_date = datetime.now() try: session.commit() except Exception as error: print(error) return 0 with cache.get_pipeline('LoginCount') as pipeline: try: pipeline.set('Login', 1) pipeline.execute() except Exception as error: print(error) # Testing with cache.get_pipeline('ranking') as pipeline: try: pipeline.zincrby('ranking:arena', 1, str(self.username)) pipeline.execute() except Exception as error: print(error) return 1