i;m trying to iterate through some values, and calculate a rank. i have a calculate_rank function where i calculate a sum of values. The problem is at the second function. I want that a user's rank to be the sum of all the user that in a follow relation with him. I am doing an iteration in the second function here where i try to add the rank of all the users that are in a follow relation with the user sent as a parameter. My problem is that the returned value is zero (0). I am sure i am mistaking in the second funtion, but i don;t see: where?
def calculate_rank(user):
rank = calculate_questions_vote(user) + calculate_votes(user) + calculate_replies(user)
return rank
def calculate_followers_rank(user):
follower = Relations.objects.filter(follow = user)
follower_rank= 0
for a in follower:
follower_rank += calculate_rank(follower)
return follower_rank
thank you!