Skip to content

feat: add scheduling service for learning resources - #49

Open
markstockhausen wants to merge 63 commits into
mainfrom
feature/add-scheduling-service-for-learning-resources
Open

feat: add scheduling service for learning resources#49
markstockhausen wants to merge 63 commits into
mainfrom
feature/add-scheduling-service-for-learning-resources

Conversation

@markstockhausen

@markstockhausen markstockhausen commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Description

Replaces the simple competency_resource_links table with a full scheduling pipeline for competency↔resource mapping, mirroring the existing competency-relationship pipeline. Users are now shown resource-matching rounds (50 % probability per round) interleaved with competency-relationship rounds. Votes are aggregated per pair, entropy is tracked for consensus scheduling, and the UI is updated to support both modes seamlessly.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Style/formatting changes (no functional changes)
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvements
  • 🔧 Configuration changes
  • 🧪 Test additions or modifications
  • 🚀 Deployment/DevOps changes

Changes Made

Client:

  • Removed competency-resource-links.ts; replaced with resource-scheduling.ts wrapping the new /api/resource-scheduling endpoints
  • Updated session-helpers.ts and types.ts to support the dual-mode session (competency relationship + resource matching)
  • SessionPage.tsx: mode is now chosen randomly at 50/50 each round (no user toggle); added stable loadMappingPair callback, mappingModeRef to avoid stale closures, and single-fire initial load guard to eliminate blank-flash on mode switch
  • MappingCard.tsx: resource card URL now wraps (break-all) instead of truncating
  • session-constants.ts: added RESOURCE_MATCH_TYPES, RESOURCE_* color/icon maps, reversed match-type order (Perfect Match → Unrelated), shared THEME_COLORS.resource

Server:

  • Replaced CompetencyResourceLinkService + CompetencyResourceLinkController with ResourceSchedulingService and ResourceSchedulingController implementing the same coverage+consensus dual-pipeline as SchedulingService
  • Added aggregate entity CompetencyResourceMapping (one row per unique competency↔resource pair with denormalised vote counters + entropy) and vote-log entity CompetencyResourceMappingVote
  • Added CompetencyResourceMappingRepository (scheduling queries: coverage pool, consensus candidates, entropy index) and CompetencyResourceMappingVoteRepository
  • Extracted SchedulingConstants utility class — COVERAGE_WEIGHT, LOW_DEGREE_POOL_SIZE, CONSENSUS_* — shared by both scheduling services; eliminated duplication
  • SchedulingService: simplified null guards (Objects.requireNonNullElse), fixed findOrCreateRelationship race condition with DataIntegrityViolationException catch-and-retry
  • Competency + LearningResource entities: added resourceLinkDegree field
  • CompetencyRepository + LearningResourceRepository: added incrementResourceLinkDegree bulk-update queries
  • Deleted CompetencyResourceLinkRepositoryTest; updated existing repository tests for V11 schema

Database:

  • V11__create_resource_mapping_tables.sql: creates competency_resource_mappings and competency_resource_mapping_votes tables with all indexes and foreign keys; adds resource_link_degree columns to competencies and learning_resources; drops the old competency_resource_links table

Testing

Test Cases

  • Existing functionality still works
  • New functionality works as expected
  • Edge cases handled appropriately

Manual Testing

  • Tested in development environment
  • Tested with different user roles/permissions (if applicable)

Screenshots

image

markstockhausen and others added 30 commits February 3, 2026 02:22
…sable component to use it on main page and while onboarding
@github-actions github-actions Bot added the enhancement New feature or request label Apr 17, 2026
@github-actions github-actions Bot added the dependencies 📦 Dependency updates label Apr 17, 2026
@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@vtotalova

Copy link
Copy Markdown
Contributor

please have a look at the merge conflicts

@github-actions github-actions Bot removed the dependencies 📦 Dependency updates label Apr 26, 2026
@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@markstockhausen

markstockhausen commented Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

please have a look at the merge conflicts

Done! ✔️

@github-actions github-actions Bot added the dependencies 📦 Dependency updates label Apr 26, 2026
@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

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

Labels

dependencies 📦 Dependency updates enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants