queries.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:ctf-manager 作者: BurningNetel 项目源码 文件源码
def get_total_score(pk):
        """  Calculates the users total score
        :param pk: primary key of an user
        :return: the total score count.
        """
        try:
            user = User.objects.get(pk=pk)
        except User.DoesNotExist:
            raise ValueError("unknown private key")

        count = 0

        for challenge in user.challenge_set.all():
            count += challenge.points

        return count
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号