mast/queries.py
def _get_user_last_activities(self, user_id: int, activity_types: list, number: int, offset: int = 0):
        """
        Returns the last activities of specified types by specified user.
        :param user_id: ID of user.
        :param activity_types: Types of activities we want to sum to total distance.
        :param number: Number of returned activities.
        :param offset: Offset of returned activities - default: 0.
        :returns: Total count of activities and list of last activities.
        """
        query = db.session.query(Activity). \
            filter(Activity.user_id == user_id,
                   func.date(Activity.datetime) >= self.SEASON.start_date,
                   func.date(Activity.datetime) <= self.SEASON.end_date,
                   Activity.type.in_(activity_types))
        count = query. \
            count()
        items = query. \
            order_by(Activity.datetime.desc()). \
            limit(number). \
            offset(offset). \
            all()
        return [count, items]

        Returns the last activities of specified types by specified user.
        :param user_id: ID of user.
        :param activity_types: Types of activities we want to sum to total distance.
        :param number: Number of returned activities.
        :param offset: Offset of returned activities - default: 0.
        :returns: Total count of activities and list of last activities.
        
Returns the last activities of specified types by specified user.
Returns the last activities of specified types by specified user .
def _get_user_last_activities(self, user_id: int, activity_types: list, number: int, offset: int = 0):
        query = db.session.query(Activity). \
            filter(Activity.user_id == user_id,
                   func.date(Activity.datetime) >= self.SEASON.start_date,
                   func.date(Activity.datetime) <= self.SEASON.end_date,
                   Activity.type.in_(activity_types))
        count = query. \
            count()
        items = query. \
            order_by(Activity.datetime.desc()). \
            limit(number). \
            offset(offset). \
            all()
        return [count, items]
def _get_user_last_activities ( self , user_id : int , activity_types : list , number : int , offset : int = 0 ) : query = db . session . query ( Activity ) . filter ( Activity . user_id == user_id , func . date ( Activity . datetime ) >= self . SEASON . start_date , func . date ( Activity . datetime ) <= self . SEASON . end_date , Activity . type . in_ ( activity_types ) ) count = query . count ( ) items = query . order_by ( Activity . datetime . desc ( ) ) . limit ( number ) . offset ( offset ) . all ( ) return [ count , items ]
Returns the last activities of specified types by specified user.
Returns the last activities of specified types by specified user .
"""
        Returns the last activities of specified types by specified user.
        :param user_id: ID of user.
        :param activity_types: Types of activities we want to sum to total distance.
        :param number: Number of returned activities.
        :param offset: Offset of returned activities - default: 0.
        :returns: Total count of activities and list of last activities.
        """
Total count of activities and list of last activities.
Total count of activities and list of last activities .
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 .
number
int
Number of returned activities.
Number of returned activities .
offset
int
Offset of returned activities - default: 0.
Offset of returned activities - default : 0 .