zeeguu/core/model/user_exercise_session.py
def _create_new_session(db_session, user_id, start_time, current_time=None):
        """
            Creates a new exercise session

            Parameters:
            db_session = database session
            user_id = user identifier
            start_time = the time when the user opened the exercise
            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 new exercise session
        """

        # If the user left the exercise open for very long, we set the duration of the session to the timeout value
        time_difference = current_time - start_time
        if time_difference > timedelta(seconds=EXERCISE_SESSION_TIMEOUT):
            start_time = current_time - timedelta(seconds=EXERCISE_SESSION_TIMEOUT)

        exercise_session = UserExerciseSession(user_id, start_time, current_time)
        db_session.add(exercise_session)
        db_session.commit()
        return exercise_session

            Creates a new exercise session

            Parameters:
            db_session = database session
            user_id = user identifier
            start_time = the time when the user opened the exercise
            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 new exercise session
        
Creates a new exercise session
Parameters:
db_session = database session
user_id = user identifier
start_time = the time when the user opened the exercise
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 new exercise session
Creates a new exercise session Parameters : db_session = database session user_id = user identifier start_time = the time when the user opened the exercise 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 new exercise session
def _create_new_session(db_session, user_id, start_time, current_time=None):
        time_difference = current_time - start_time
        if time_difference > timedelta(seconds=EXERCISE_SESSION_TIMEOUT):
            start_time = current_time - timedelta(seconds=EXERCISE_SESSION_TIMEOUT)
        exercise_session = UserExerciseSession(user_id, start_time, current_time)
        db_session.add(exercise_session)
        db_session.commit()
        return exercise_session
def _create_new_session ( db_session , user_id , start_time , current_time = None ) : time_difference = current_time - start_time if time_difference > timedelta ( seconds = EXERCISE_SESSION_TIMEOUT ) : start_time = current_time - timedelta ( seconds = EXERCISE_SESSION_TIMEOUT ) exercise_session = UserExerciseSession ( user_id , start_time , current_time ) db_session . add ( exercise_session ) db_session . commit ( ) return exercise_session
Creates a new exercise session
Parameters:
db_session = database session
user_id = user identifier
start_time = the time when the user opened the exercise
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)
Creates a new exercise session Parameters : db_session = database session user_id = user identifier start_time = the time when the user opened the exercise 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 )
"""
            Creates a new exercise session

            Parameters:
            db_session = database session
            user_id = user identifier
            start_time = the time when the user opened the exercise
            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 new exercise session
        """ # If the user left the exercise open for very long, we set the duration of the session to the timeout value
db_session
user_id
start_time
current_time