Skip to content

fix(all-users): handle program names in programs array#779

Closed
ismaeldosil wants to merge 7 commits intomasterfrom
staging
Closed

fix(all-users): handle program names in programs array#779
ismaeldosil wants to merge 7 commits intomasterfrom
staging

Conversation

@ismaeldosil
Copy link
Collaborator

Summary

  • Handle case where users have program name stored in programs[] instead of ID
  • Added fallback to check if value is a known program name when ID lookup fails
  • Also includes fix for legacy programId field

Root Cause

Some users have inconsistent data formats:

// Expected (ID)
programs: ["z5zmUqERgQJeN0jQ5sYx"]

// Legacy format found
programs: ["United Way"]  // name instead of ID

Changes in getAllUsers()

Now handles 3 formats in priority order:

  1. programs[] array - tries as ID first, falls back to matching as name
  2. programId string (legacy) - maps ID to name
  3. program field (legacy) - handles both ID and name

Test Results

=== SUMMARY ===
Success: 17
Failed: 0

✅ ALL USERS WITH PROGRAM DATA NOW RESOLVE CORRECTLY!

Closes CHALK-080

- AllUsersPage.tsx / AllUsersTable.tsx - New admin page to view all users in the system with a sortable, filterable table
- App.tsx / BurgerMenu.tsx - Added routing and navigation menu entry for the new "All Users" page
- Firebase.tsx - New method fetchAllUsers() to retrieve all users from Firestore
- Types.tsx - Extended User interface with optional fields (email, school, archived, lastLogin) for reuse across components
- xlsxGenerator.ts - Added user export functionality using centralized Types.User
- seed-full.js / seed-local.js / seed-local.sh - Scripts to populate local emulators with test data
- .gitignore - Exclude internal project files
- README.md - Documentation for local development setup
- cypress/all-users.ts - E2E tests for the All Users feature
- functions/package-lock.json - Updated Node engine (10→20)
- yarn.lock - Dependency updates
fix: restore yarn.lock to fix CI parsing error
AllUsers page UI improvements
LeaderBoard All Users improvements
Add Leaderboard 'All users' loading state
fix(all-users): read legacy programId formats
fix(all-users): handle program names in programs array
@ismaeldosil
Copy link
Collaborator Author

Recreating with cleaner history

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.

1 participant