Skip to content

IA-958 : feat: Rework fetchAssignedSubjects to use bulk UUID lookup with client-side filtering and category label normalization

khadija.elbachouri a demandé de fusionner feature/IA-958 vers develop

Summary

Replaces the single-endpoint assigned subjects fetch with a two-step approach: first resolve assigned UUIDs, then fetch full subject details in bulk. Adds French category label mapping and fixes client-side filtering. Also cleans up the Learning screen's fetch effect.

Changes

subjectEndpoints

  • Added getSubjectsByUuids endpoint: POST .../subjects/by-uuids

subjectStore (mobile)

  • Added categoryLabels map to normalize API category keys (e.g. MATHEMATIQUES) into French display labels
  • Rewrote fetchAssignedSubjects with a two-step flow:
    1. GET assigned subjects to extract subjectUuid list
    2. POST to getSubjectsByUuids with { uuids, childUuid } to fetch full subject details
  • Applied categoryLabels mapping during subject normalization, with fallback to raw value
  • Normalizes subjectUuid by falling back to s.uuid
  • Moved category and name filtering to client-side on the fetched results, replacing the previous query-param approach
  • Added early return with empty subjects when no UUIDs are assigned

Learning screen

  • Simplified fetch useEffect: removed the null check branch and unified category argument — passes undefined for "Tous" instead of undefined vs filtered array
  • Omitted fetchAssignedSubjects from the dependency array intentionally to prevent infinite re-fetch loop (documented in comment)
  • Passes searchQuery || undefined to avoid sending empty string to the store

Rapports de requête de fusion