Пример #1
0
    def get_by_event_and_class(cls, event_id, weightclass_code):
        db = DataInterface(CONSTANTS.DB_NAME)
        sql = "SELECT * FROM %s WHERE event_id = %d AND weightclass_code = '%s'" % (
            cls.__name__, int(event_id), weightclass_code)
        result = db.fetch_multiple(sql)

        return [cls(**(item)) for item in result if item]
Пример #2
0
 def get_by_bracket(cls, bracket_id, order=None):
     db = DataInterface(CONSTANTS.DB_NAME)
     sql = "SELECT * FROM %s WHERE bracket_id = %d" % (cls.__name__,
                                                       int(bracket_id))
     if order:
         sql = "%s ORDER BY %s" % (sql, order)
     return [cls(**(item)) for item in db.fetch_multiple(sql)]