Beispiel #1
0
    def test_votes_for_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_for_count(self.account1.id), 1)
        self.assertEqual(VotePrototype.votes_for_count(self.account2.id), 0)
        self.assertEqual(VotePrototype.votes_for_count(self.account3.id), 0)
        self.assertEqual(VotePrototype.votes_for_count(self.account4.id), 0)
Beispiel #2
0
    def test_votes_for_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_for_count(self.account1.id), 1)
        self.assertEqual(VotePrototype.votes_for_count(self.account2.id), 0)
        self.assertEqual(VotePrototype.votes_for_count(self.account3.id), 0)
        self.assertEqual(VotePrototype.votes_for_count(self.account4.id), 0)
Beispiel #3
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)
Beispiel #4
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)