def test_votes_agains_count(self): VotePrototype.create(self.account2, self.bill, relations.VOTE_TYPE.AGAINST) VotePrototype.create(self.account3, self.bill, relations.VOTE_TYPE.REFRAINED) self.assertEqual(VotePrototype.votes_against_count(self.account1.id), 0) self.assertEqual(VotePrototype.votes_against_count(self.account2.id), 1) self.assertEqual(VotePrototype.votes_against_count(self.account3.id), 0) self.assertEqual(VotePrototype.votes_against_count(self.account4.id), 0)
def test_votes_agains_count(self): VotePrototype.create(self.account2, self.bill, relations.VOTE_TYPE.AGAINST) VotePrototype.create(self.account3, self.bill, relations.VOTE_TYPE.REFRAINED) self.assertEqual(VotePrototype.votes_against_count(self.account1.id), 0) self.assertEqual(VotePrototype.votes_against_count(self.account2.id), 1) self.assertEqual(VotePrototype.votes_against_count(self.account3.id), 0) self.assertEqual(VotePrototype.votes_against_count(self.account4.id), 0)
def get_achievement_type_value(self, achievement_type): from the_tale.game.bills.prototypes import BillPrototype, VotePrototype if achievement_type.is_POLITICS_ACCEPTED_BILLS: return BillPrototype.accepted_bills_count(self.id) elif achievement_type.is_POLITICS_VOTES_TOTAL: return VotePrototype.votes_count(self.id) elif achievement_type.is_POLITICS_VOTES_FOR: return VotePrototype.votes_for_count(self.id) elif achievement_type.is_POLITICS_VOTES_AGAINST: return VotePrototype.votes_against_count(self.id) elif achievement_type.is_KEEPER_MIGHT: return self.might raise exceptions.UnkwnownAchievementTypeError(achievement_type=achievement_type)
def get_achievement_type_value(self, achievement_type): from the_tale.game.bills.prototypes import BillPrototype, VotePrototype if achievement_type.is_POLITICS_ACCEPTED_BILLS: return BillPrototype.accepted_bills_count(self.id) elif achievement_type.is_POLITICS_VOTES_TOTAL: return VotePrototype.votes_count(self.id) elif achievement_type.is_POLITICS_VOTES_FOR: return VotePrototype.votes_for_count(self.id) elif achievement_type.is_POLITICS_VOTES_AGAINST: return VotePrototype.votes_against_count(self.id) elif achievement_type.is_KEEPER_MIGHT: return self.might raise exceptions.UnkwnownAchievementTypeError(achievement_type=achievement_type)