示例#1
0
            acc.username = member.username
            session.add(acc)
            session.commit()
            session.refresh(acc)
            acc_id = acc.id
        else:
            acc_id = acc_in_db.id

        hiscores = member.hiscores
        if hiscores != None:
            most_rec = session.query(SkillTable).filter(SkillTable.account_id == acc_id).filter(
                SkillTable.skill_id == 0).order_by("timestamp").first()
            if most_rec != None:
                if hiscores["Overall"]["XP"] > most_rec.xp:
                    add_hiscore(hiscores, acc_id, session)
            else:
                add_hiscore(hiscores, acc_id, session)


if __name__ == "__main__":
    engine = _create_engine()
    clan_name = BaseConfig.CLAN_NAME
    clan = RSClan(clan_name)

    if not engine.dialect.has_table(engine, SkillTable):
        Base().metadata.create_all(engine)
    Session = sessionmaker(bind=engine)
    session = Session()

    _do_service(session)
示例#2
0
 def to_json(self):
   data = Base.to_json(self)
   data['options'] = [o.to_json() for o in self.options]
   return data
示例#3
0
 def to_json(self):
   res = Base.to_json(self)
   res['level'] = self.level
   return res
示例#4
0
 def __init__(self):
   Base.__init__(self)
 def to_json(self):
     data = Base.to_json(self)
     data['name'] = f'{self.size} / {self.color}'
     return data
示例#6
0
 def __init__(self, **kwargs):
     Base.__init__(self, **kwargs)
示例#7
0
 def setUp(self):
     self.app = app.test_client()
     self.db = Base.get_db()