Skip to content

Refactor and modularize fetchProblemsForSession() + integrate session performance summary #1

@smithrashell

Description

@smithrashell

Problem

fetchProblemsForSession() currently has 5+ distinct responsibilities and is difficult to test or extend:

  1. Pulls settings
  2. Computes adaptive values
  3. Fetches review problems
  4. Fetches new problems
  5. Deduplicates + pads session
  6. Logs and returns session

This makes reasoning about the logic harder and prevents reusability in other flows (e.g. onboarding, review-only mode).


Proposed Refactor

Break into 3 distinct layers:

  • createSession()High-level coordinator

  • buildAdaptiveSessionSettings()Handles adaptive sizing & difficulty logic

  • fetchAndAssembleSessionProblems()Handles fetching review + new problems, deduping, padding


Labels

  • refactor
  • enhancement
  • tech-debt
  • priority: medium

Outcome

  • Cleaner, testable separation of concerns
  • Prepares for session dashboards, mastery trends
  • Lays groundwork for contributors or A/B testing in session logic

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestrefactorchanging the internal structure of code without changing its external behaviortech-debtcode that was once acceptable but has become a liability — too tightly coupled, hard to test, etc

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions