mast/queries.py
def _get_position_total_distance(self, user_id: int, activity_types: list):
        """
        Returns position of the current user in the total distance competition in specified activity types.
        :param user_id: ID of user.
        :param activity_types: Types of activities we want to sum to total distance.
        :returns: Position of user or -1.
        """
        all_users = self._get_top_users_total_distance_query(activity_types).all()

        order = 0
        for user in all_users:
            order = order + 1
            if user.User.id == user_id:
                return order
        return -1

        Returns position of the current user in the total distance competition in specified activity types.
        :param user_id: ID of user.
        :param activity_types: Types of activities we want to sum to total distance.
        :returns: Position of user or -1.
        
Returns position of the current user in the total distance competition in specified activity types.
Returns position of the current user in the total distance competition in specified activity types .
def _get_position_total_distance(self, user_id: int, activity_types: list):
        all_users = self._get_top_users_total_distance_query(activity_types).all()
        order = 0
        for user in all_users:
            order = order + 1
            if user.User.id == user_id:
                return order
        return -1
def _get_position_total_distance ( self , user_id : int , activity_types : list ) : all_users = self . _get_top_users_total_distance_query ( activity_types ) . all ( ) order = 0 for user in all_users : order = order + 1 if user . User . id == user_id : return order return - 1
Returns position of the current user in the total distance competition in specified activity types.
Returns position of the current user in the total distance competition in specified activity types .
"""
        Returns position of the current user in the total distance competition in specified activity types.
        :param user_id: ID of user.
        :param activity_types: Types of activities we want to sum to total distance.
        :returns: Position of user or -1.
        """
Position of user or -1.
Position of user or - 1 .
self
user_id
int
ID of user.
ID of user .
activity_types
list
Types of activities we want to sum to total distance.
Types of activities we want to sum to total distance .