Skip to content

Conversation

@rammakablecode
Copy link

Description

This PR integrates and corrects the session tracking logic for the 10.0.x branch. It uses the service-layer approach originally proposed in PR #74, while addressing missing schema definitions and environment blockers currently on 10.0.x.

During testing, I identified issues that blocked development and limited the usefulness of the existing schema:

  • MySQL tablespace errors (errno: 194) prevented successful migrations in Windows-hosted Docker environments.
  • CRLF line endings in shell scripts caused Dev Container startup failures.
  • The frontend would have to fetch every session_activity timestamp and compute gaps client-side, which is inefficient and complex.

To resolve these, this PR:

  • Fixes the migration sequence to avoid tablespace issues.
  • Standardizes shell scripts to LF line endings for Docker compatibility.
  • Adds a duration_minutes column to the marking_sessions table, allowing session durations to be calculated and aggregated directly in the backend.

Frontend impact
Persisting duration_minutes enables direct aggregation via the API and removes the need for complex time-delta calculations in the Angular frontend. This change is intended to support(thoth-tech/doubtfire-web#402). By providing this data via the API, we avoid complex time-delta calculations in the Angular frontend, allowing 402 to be refactored to connect directly to this backend logic since the frontend contributions are yet to connect to exisitng backend.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Test A: Migration Sequence
    Executed bundle exec rails db:migrate:redo VERSION=20250922103033.

    Verified:
    marking_sessions table is created successfully
    duration_minutes column exists
    No MySQL tablespace errors occur

  • Test B: Session Tracking Logic
    Ran bundle exec ruby -I test test/services/session_tracker_test.rb.
    Result: 2 runs, 13 assertions, 0 failures, 0 errors.

    Confirmed:
    15-minute "sticky" session window works
    duration_minutes is correctly updated upon activity.

image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

martindolores and others added 2 commits January 26, 2026 19:14
- implement session tracker service with integration test
- amend marking session update_session_details method to initalize date
  time before assigning
@SteveDala
Copy link

@rammakablecode please change the base of this pull request to be thoth-tech:10.0.x.

@rammakablecode rammakablecode changed the base branch from development to 10.0.x January 26, 2026 14:59
@rammakablecode
Copy link
Author

Changed base @SteveDala thank you for that catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants