def get_by_bracket_source_match(cls, bracket_id, source_match): db = DataInterface(CONSTANTS.DB_NAME) sql = "SELECT * FROM %s WHERE bracket_id = %d AND (bot1_source_match = '%s' OR bot2_source_match = '%s')" % ( cls.__name__, int(bracket_id), source_match, source_match) result = db.fetch_one(sql) return cls(**(result)) if result else None
def get_by_bracket_round(cls, bracket_id, round): db = DataInterface(CONSTANTS.DB_NAME) sql = "SELECT * FROM %s WHERE bracket_id = %d and round='%s' ORDER BY number" % ( cls.__name__, int(bracket_id), round) results = db.fetch_multiple(sql) return [cls(**(item)) for item in results if item]
def get_by_bracket_seed(cls, event_id, bracket_id, seed): db = DataInterface(CONSTANTS.DB_NAME) sql = "SELECT * FROM %s WHERE event_id = %d AND seed_number = %d AND bracket_id = %d" % ( cls.__name__, int(event_id), seed, bracket_id) result = db.fetch_one(sql) return cls(**(result)) if result else None
def get_by_bracket_seed(cls, event_id, bracket_id, seed): db = DataInterface(CONSTANTS.DB_NAME) sql = "SELECT * FROM %s WHERE event_id = %d AND seed_number = %d AND bracket_id = %d" % (cls.__name__, int(event_id), seed, bracket_id) result = db.fetch_one(sql) return cls(**(result)) if result else None
def get_by_bracket_source_match(cls, bracket_id, source_match): db = DataInterface(CONSTANTS.DB_NAME) sql = "SELECT * FROM %s WHERE bracket_id = %d AND (bot1_source_match = '%s' OR bot2_source_match = '%s')" % (cls.__name__, int(bracket_id), source_match, source_match) result = db.fetch_one(sql) return cls(**(result)) if result else None
def get_by_bracket_round(cls, bracket_id, round): db = DataInterface(CONSTANTS.DB_NAME) sql = "SELECT * FROM %s WHERE bracket_id = %d and round='%s' ORDER BY number" % (cls.__name__, int(bracket_id), round) results = db.fetch_multiple(sql) return [cls(**(item)) for item in results if item]