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 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 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 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 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)
def find_by_amadeus_id(self, amadeus_id, cursor): hotels_query = """SELECT * FROM hotels WHERE amadeus_id = %s""" cursor.execute(hotels_query, (amadeus_id, )) record = cursor.fetchone() return db.build_from_record(models.Hotel, record)
def location(self, cursor): location_query = """SELECT * FROM locations WHERE locations.id = %s""" cursor.execute(location_query, (self.location_id,)) record = cursor.fetchone() return db.build_from_record(models.Location, record)
def find_by_foursquare_id(self, foursquare_id, cursor): foursquare_query = """SELECT * FROM venues WHERE foursquare_id = %s""" cursor.execute(foursquare_query, (foursquare_id, )) record = cursor.fetchone() return db.build_from_record(models.Venue, 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)