def test_after_remove_ignore_increaseExp(self): self.database.remove_ignore_xp_channel(3, 5) self.database.set_ignore_xp_channel(3, 5) self.database.remove_ignore_xp_channel(3, 5) self.database.increase_exp(3, 5, default_user_id, 10) member = Member.get_by_id(default_user_id) assert member.exp == 10
def __update_rank_if_qualified(self, member_id: int): member = Member.get_by_id(member_id) new_rank = member.rank while (member.exp > Util.get_rank_exp(new_rank + 1)): new_rank += 1 if new_rank != member.rank: member.rank = new_rank member.save() return member.rank
def get_member_rank_order(self, member_id: int): target_exp = Member.get_by_id(member_id).exp return Member.select().where((Member.exp > target_exp)).count() + 1
def force_update_rank(self, member_id: int, new_rank: int): member = Member.get_by_id(member_id) member.rank = new_rank member.save() return member.rank
def test_rankUp(self): member = Member.get_by_id(default_user_id) assert member.rank == 0 self.database.increase_exp(0, 0, default_user_id, 100) member = Member.get_by_id(default_user_id) assert member.rank == 1
def test_increaseExp(self): self.database.increase_exp(0, 0, default_user_id, 10) member = Member.get_by_id(default_user_id) assert member.exp == 10
def test_addMultipleMembers(self): member_ids = [1, 2, 3, 4, 5, 6, 7, 8] self.database.add_members(member_ids) for member_id in member_ids: member = Member.get_by_id(member_id) assert member.member_id == member_id