当前位置: 首页>>代码示例>>Python>>正文


Python BillPrototype.accepted_bills_count方法代码示例

本文整理汇总了Python中the_tale.game.bills.prototypes.BillPrototype.accepted_bills_count方法的典型用法代码示例。如果您正苦于以下问题:Python BillPrototype.accepted_bills_count方法的具体用法?Python BillPrototype.accepted_bills_count怎么用?Python BillPrototype.accepted_bills_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在the_tale.game.bills.prototypes.BillPrototype的用法示例。


在下文中一共展示了BillPrototype.accepted_bills_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_accepted_bills_count

# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import accepted_bills_count [as 别名]
    def test_accepted_bills_count(self):
        for state in relations.BILL_STATE.records:
            bill = self.create_bill(self.account1)
            bill.state = state
            bill.save()

        for state in relations.BILL_STATE.records:
            bill = self.create_bill(self.account2)
            bill.state = state
            bill.save()

        self.assertEqual(BillPrototype.accepted_bills_count(self.account1.id), 1)
        self.assertEqual(BillPrototype.accepted_bills_count(self.account2.id), 1)
        self.assertEqual(BillPrototype.accepted_bills_count(self.account3.id), 0)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:16,代码来源:test_prototype.py

示例2: get_achievement_type_value

# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import accepted_bills_count [as 别名]
    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)
开发者ID:ruckysolis,项目名称:the-tale,代码行数:17,代码来源:prototypes.py

示例3: account_sidebar

# 需要导入模块: from the_tale.game.bills.prototypes import BillPrototype [as 别名]
# 或者: from the_tale.game.bills.prototypes.BillPrototype import accepted_bills_count [as 别名]
def account_sidebar(user_account, page_account, page_caption, page_type, can_moderate=False):
    from the_tale.forum.models import Thread
    from the_tale.game.bills.prototypes import BillPrototype
    from the_tale.linguistics.prototypes import ContributionPrototype
    from the_tale.linguistics.relations import CONTRIBUTION_TYPE
    from the_tale.accounts.friends.prototypes import FriendshipPrototype
    from the_tale.accounts.clans.logic import ClanInfo
    from the_tale.blogs.models import Post as BlogPost, POST_STATE as BLOG_POST_STATE

    bills_count = BillPrototype.accepted_bills_count(page_account.id)

    threads_count = Thread.objects.filter(author=page_account._model).count()

    threads_with_posts = Thread.objects.filter(post__author=page_account._model).distinct().count()

    templates_count = ContributionPrototype._db_filter(account_id=page_account.id,
                                                       type=CONTRIBUTION_TYPE.TEMPLATE).count()

    words_count = ContributionPrototype._db_filter(account_id=page_account.id,
                                                   type=CONTRIBUTION_TYPE.WORD).count()

    folclor_posts_count = BlogPost.objects.filter(author=page_account._model, state=BLOG_POST_STATE.ACCEPTED).count()

    friendship = FriendshipPrototype.get_for_bidirectional(user_account, page_account)

    return jinja2.Markup(jinja2.render('accounts/sidebar.html',
                                            context={'user_account': user_account,
                                                     'page_account': page_account,
                                                     'page_caption': page_caption,
                                                     'master_clan_info': ClanInfo(page_account),
                                                     'own_clan_info': ClanInfo(user_account),
                                                     'friendship': friendship,
                                                     'bills_count': bills_count,
                                                     'templates_count': templates_count,
                                                     'words_count': words_count,
                                                     'folclor_posts_count': folclor_posts_count,
                                                     'threads_count': threads_count,
                                                     'threads_with_posts': threads_with_posts,
                                                     'can_moderate': can_moderate,
                                                     'page_type': page_type,
                                                     'commission': conf.accounts_settings.MONEY_SEND_COMMISSION}))
开发者ID:Alkalit,项目名称:the-tale,代码行数:43,代码来源:jinjaglobals.py


注:本文中的the_tale.game.bills.prototypes.BillPrototype.accepted_bills_count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。