Skip to content

Conversation

@rammakablecode
Copy link

@rammakablecode rammakablecode commented Jan 28, 2026

Description

This PR enhances the Tutor Analytics view, transforming it from a calendar timetable for a selected period into a comprehensive data dashboard. It uses the recently added duration_minutes backend logic to provide summary insights and trend charts into the marking session efficiency and workload.

Key Motivations:

  • Previous frontend PRs to 9.x relied on dummy data. This uses the GRAPE endpoint and is ready to use the updated session_tracker.rb and schema from Refactor and Finalize Session Tracking (Building on closed unmerged #74) doubtfire-api#83
  • Reduced the computation on client side for analytics:
    By utilizing the backend-calculated duration_minutes, the frontend no longer needs to perform time-delta calculations, so its only filter logic and O(n) calcs in the frontend.
  • Visual Data Trends:
    The 10.0.x branch only contained the option to download sessions and view the session timetable. Grouped bar charts now make it easy to compare time spent and tasks assessed trends over time.
  • At a glance metrics:
    Summary tiles provide visibility to metrics like total hours, submissions opened, assessments made and average minutes per assessment.

Dependencies:

  • Added @swimlane/ngx-charts (v20.5.0) for data visualization.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Screenshot 2026-01-29 032756
  • Build & quality
    Production build: ng build --configuration production passes (AOT-safe)
    Linting: npm run lint passes (fixed any usage and unused imports)
  • Data & logic
    Date ranges: Custom ranges correctly include every day, even with zero activity
    Zero safety: Efficiency shows 0 instead of NaN when no assessments exist
    Filtering: Selecting a tutor updates both summary cards and charts
image

Testing Checklist:

  • Tested in latest Chrome

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@Rana7xi
Copy link

Rana7xi commented Jan 28, 2026

This is a really solid improvement. The summary cards make the data much easier to read and the layout feels clearer and more useful than the previous timetable-style view. The new calculations for total time, assessments, average minutes per assessment and submissions viewed all make sense, and it’s nice to see edge cases handled (like showing 0 instead of NaN when there’s no data). The date range logic and daily grouping also look well especially including days with zero activity. I also liked the cleanup of not used imports. I don’t see anything blocking here.

Copy link

@JeffySam JeffySam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a strong and well-thought-out enhancement to the Tutor Analytics view. The shift from a timetable-style calendar to a dashboard-style layout significantly improves readability and usefulness, especially for quickly understanding workload and marking efficiency.

The use of the backend-calculated duration_minutes is a solid architectural decision. Offloading time calculations to the API simplifies the frontend logic, reduces unnecessary client-side computation, and makes the analytics more reliable overall. The summary metrics (total time, assessments made, average minutes per assessment, and submissions viewed) are clear, intuitive, and aligned with what tutors would actually want to see at a glance.

The trend chart is a great addition. Grouping by day and explicitly including zero-activity days makes the data far more honest and easier to interpret over time. Handling edge cases—such as displaying 0 instead of NaN when no assessments exist—shows good defensive thinking and attention to detail.

I also appreciated the general cleanup in this PR: unused imports removed, lint passing cleanly, and the fact that this now uses the real GRAPE endpoint instead of dummy data makes it production-ready. The dependency addition (ngx-charts) feels justified and well-contained.

Copy link

@ishika021 ishika021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very good enhancement to the Tutor Analytics view because of its solid and well-structured design. By changing the existing timetable-style layout to a dashboard with summary cards and trend charts, the Tutor Analytics view has become significantly easier to read and provides greater analytical value.

The new analytical layout allows tutors to quickly see their overall marking activity and track trends over time, rather than having to interpret lists of raw sessions.

Choosing to use duration_minutes values from the backend, rather than calculating session lengths on the frontend, is a strong design decision for the Tutor Analytics views. This choice reduces the amount of duplicated logic between the frontend and the backend, ensures consistency in data across different client applications, and reduces the complexity of the front-end code. Using backend values also provides increased robustness for the Tutor Analytics views as the way marking sessions are recorded may change in the future.

It seems that careful consideration has been given to handling edge cases in regards to the design of the Tutor Analytics dashboard. For example, defaulting to a value of zero. The summary metrics and explicitly including days with no activity in the dashboard chart allows the dashboards to be stable and easily interpreted, even if a tutor has very few or irregular activity in the system. Thoughtful consideration of such details improves the accuracy and reliability of analytics-based views.

I think @swimlane/ngx-charts make sense in this context since they provide value to the dashboard without cluttering the UI. They appear easy to implement, and the analytics components appear organized and self-contained. I feel that the changes in this implementation are easy to track in terms of maintainability and are consistent with existing Angular patterns in the codebase.

I do not see any structural or architectural issues with this implementation. It is complete and ready to use.

Copy link

@Rana7xi Rana7xi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really solid improvement. The summary cards make the data much easier to read and the layout feels clearer and more useful than the previous timetable-style view. The new calculations for total time, assessments, average minutes per assessment and submissions viewed all make sense, and it’s nice to see edge cases handled (like showing 0 instead of NaN when there’s no data). The date range logic and daily grouping also look well especially including days with zero activity. I also liked the cleanup of not used imports. I don’t see anything blocking here.

@rammakablecode rammakablecode force-pushed the feature-tutor-analysis-10x branch from 03e4acf to df99b67 Compare January 30, 2026 02:39
Copy link

@BrianDangDev BrianDangDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved please open a upstream PR, remember to cross reference with the backend upsteam PR

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.

5 participants