zeeguu/core/model/user_reading_session.py
def _update_last_action_time(
        self, db_session, add_grace_time=False, current_time=datetime.now()
    ):
        """
        Updates the last_action_time field. For sessions that were left open, since we cannot know exactly
        when the user stopped using it, we give an additional (reading_session_timeout) time benefit

        Parameters:
        db_session = database session
        add_grace_time = True/False boolean value to add an extra reading_session_timeout minutes after the last_action_datetime
        current_time = when this parameter is sent, instead of using the datetime.now() value for the current time
                    we use the provided value as the system time (only used for filling in historical data)

        returns: The reading session
        """

        if add_grace_time:
            self.last_action_time += timedelta(minutes=READING_SESSION_TIMEOUT)
        else:
            self.last_action_time = current_time

        try:
            db_session.add(self)
            db_session.commit()
        except:
            import traceback

            traceback.print_exc()
            print(self.id)
        return self

        Updates the last_action_time field. For sessions that were left open, since we cannot know exactly
        when the user stopped using it, we give an additional (reading_session_timeout) time benefit

        Parameters:
        db_session = database session
        add_grace_time = True/False boolean value to add an extra reading_session_timeout minutes after the last_action_datetime
        current_time = when this parameter is sent, instead of using the datetime.now() value for the current time
                    we use the provided value as the system time (only used for filling in historical data)

        returns: The reading session
        
Updates the last_action_time field. For sessions that were left open, since we cannot know exactly
when the user stopped using it, we give an additional (reading_session_timeout) time benefit

db_session = database session
add_grace_time = True/False boolean value to add an extra reading_session_timeout minutes after the last_action_datetime
current_time = when this parameter is sent, instead of using the datetime.now() value for the current time
we use the provided value as the system time (only used for filling in historical data)

The reading session
Updates the last_action_time field . For sessions that were left open since we cannot know exactly when the user stopped using it we give an additional ( reading_session_timeout ) time benefit db_session = database session add_grace_time = True / False boolean value to add an extra reading_session_timeout minutes after the last_action_datetime current_time = when this parameter is sent instead of using the datetime . now () value for the current time we use the provided value as the system time ( only used for filling in historical data ) The reading session
def _update_last_action_time(
        self, db_session, add_grace_time=False, current_time=datetime.now()
    ):
        if add_grace_time:
            self.last_action_time += timedelta(minutes=READING_SESSION_TIMEOUT)
        else:
            self.last_action_time = current_time
        try:
            db_session.add(self)
            db_session.commit()
        except:
            import traceback
            traceback.print_exc()
            print(self.id)
        return self
def _update_last_action_time ( self , db_session , add_grace_time = False , current_time = datetime . now ( ) ) : if add_grace_time : self . last_action_time += timedelta ( minutes = READING_SESSION_TIMEOUT ) else : self . last_action_time = current_time try : db_session . add ( self ) db_session . commit ( ) except : import traceback traceback . print_exc ( ) print ( self . id ) return self
Updates the last_action_time field.
Updates the last_action_time field .
"""
        Updates the last_action_time field. For sessions that were left open, since we cannot know exactly
        when the user stopped using it, we give an additional (reading_session_timeout) time benefit

        Parameters:
        db_session = database session
        add_grace_time = True/False boolean value to add an extra reading_session_timeout minutes after the last_action_datetime
        current_time = when this parameter is sent, instead of using the datetime.now() value for the current time
                    we use the provided value as the system time (only used for filling in historical data)

        returns: The reading session
        """
self
db_session
add_grace_time
current_time