mast/queries.py
def _get_global_total_distance(self, activity_types: list):
        """
        Returns the total distance by all users in specified activity types.
        :param activity_types: Types of activities we want to sum to total distance.
        :returns: The total distance in kilometres.
        """
        return db.session.query(func.sum(Activity.distance)). \
                   select_from(User). \
                   join(User.activities). \
                   filter(func.date(Activity.datetime) >= self.SEASON.start_date,
                          func.date(Activity.datetime) <= self.SEASON.end_date,
                          Activity.type.in_(activity_types),
                          User.verified). \
                   scalar() or 0

        Returns the total distance by all users in specified activity types.
        :param activity_types: Types of activities we want to sum to total distance.
        :returns: The total distance in kilometres.
        
Returns the total distance by all users in specified activity types.
Returns the total distance by all users in specified activity types .
def _get_global_total_distance(self, activity_types: list):
        return db.session.query(func.sum(Activity.distance)). \
                   select_from(User). \
                   join(User.activities). \
                   filter(func.date(Activity.datetime) >= self.SEASON.start_date,
                          func.date(Activity.datetime) <= self.SEASON.end_date,
                          Activity.type.in_(activity_types),
                          User.verified). \
                   scalar() or 0
def _get_global_total_distance ( self , activity_types : list ) : return db . session . query ( func . sum ( Activity . distance ) ) . select_from ( User ) . join ( User . activities ) . filter ( func . date ( Activity . datetime ) >= self . SEASON . start_date , func . date ( Activity . datetime ) <= self . SEASON . end_date , Activity . type . in_ ( activity_types ) , User . verified ) . scalar ( ) or 0
Returns the total distance by all users in specified activity types.
Returns the total distance by all users in specified activity types .
"""
        Returns the total distance by all users in specified activity types.
        :param activity_types: Types of activities we want to sum to total distance.
        :returns: The total distance in kilometres.
        """
The total distance in kilometres.
The total distance in kilometres .
self
activity_types
list
Types of activities we want to sum to total distance.
Types of activities we want to sum to total distance .