@marshal_with(object_resource_fields)
    def get(self, object_id):
        args = self.parser.parse_args()

        vote = args['vote']

        amount = ObjectsManager(**args).score(object_id=object_id) or 0

        votes_no = ObjectSubjectsManager(**args).count(
            object_id=object_id,
            min_vote=vote or '-inf',
            max_vote=vote or '+inf',
        )

        if not votes_no:
            average = 0
            amount = 0
        elif vote:
            average = vote
            amount = vote * votes_no
        else:
            average = amount / votes_no

        return (
            dict(
                votes_no=votes_no,
                average=average,
                amount=amount,
                object_id=object_id,
            )
        )
dataset/ETHPy150Open BuongiornoMIP/Reding/reding/resources.py/VotedSummaryResource.get/original