def earnings(self, TS_details, conn, cursor): earnings_query = "SELECT * FROM earnings WHERE earnings.game_id = %s" cursor.execute(earnings_query, (self.id, )) record = cursor.fetchone() earnings = db.build_from_record(models.Earnings, record) earnings.check_update_revenue_downloads(TS_details, conn, cursor) return earnings
def get_sibling(self, name, os, cursor): new_name = db.strip_last_specialchar(name) os_bar = {'android': 'iOS', 'iOS': 'android'} query = "SELECT * FROM %s WHERE platform = '%s' AND name LIKE '%s%%';" % ( self.__table__, os_bar[os], new_name) cursor.execute(query) record = cursor.fetchone() return db.build_from_record(models.Game, record)
def game(self, cursor): game_query = "SELECT * FROM games WHERE id = %s;" cursor.execute(game_query, (self.game_id,)) record = cursor.fetchone() return db.build_from_record(models.Game, record)
def ratings(self, cursor): ratings_query = "SELECT * FROM ratings WHERE ratings.game_id = %s;" cursor.execute(ratings_query, (self.id, )) record = cursor.fetchone() return db.build_from_record(models.Rating, record)
def find_by_game_name_platform(self, name, platform, cursor): game_query = "SELECT * FROM games WHERE name = %s AND platform = %s;" cursor.execute(game_query, (name, platform)) record = cursor.fetchone() return db.build_from_record(models.Game, record)
def earnings(self, cursor): earnings_query = "SELECT * FROM earnings WHERE game_id = %s;" cursor.execute(earnings_query, (self.game_id, )) record = cursor.fetchone() return db.build_from_record(models.Earnings, record)
def find_by(self, game_id, rank_type, ranking, date_created, cursor): rating_query = "SELECT * FROM ratings WHERE game_id = %s AND rank_type = %s AND ranking = %s AND date_created = %s;" cursor.execute(rating_query, (game_id, rank_type, ranking, date_created)) record = cursor.fetchone() return db.build_from_record(models.Rating, record)