Reorganized the monolithic util/api_proccesor.js (419 lines) into a clean, domain-specific folder structure with one function per file.
Note: This is a pure refactor of functions that exist in main's api_proccesor.js. Functions from the feat/graphql-curriculum-caching branch (FCC Proper integration, challengeMap utilities) are preserved in the backup branch refactor/organize-util-functions-with-fcc-proper for later integration.
- KEPT:
util/api_proccesor.js- Original monolithic file remains unchanged - NOTE: Yes, it's misspelled as "proccesor" instead of "processor"
- This ensures if any issues arise, the original file is still there for reference
util/
├── api_proccesor.js # Original (unchanged, will be removed after merge)
├── curriculum/ # Curriculum metadata & fetching (4 files)
│ ├── constants.js
│ ├── getAllTitlesAndDashedNamesSuperblockJSONArray.js
│ ├── getAllSuperblockTitlesAndDashedNames.js
│ └── getSuperblockTitlesInClassroomByIndex.js
├── dashboard/ # Dashboard data transformation (2 files)
│ ├── createSuperblockDashboardObject.js
│ └── sortSuperBlocks.js
├── student/ # Student progress & data (5 files)
│ ├── calculateProgress.js (3 functions)
│ │ • getTotalChallengesForSuperblocks
│ │ • getStudentProgressInSuperblock
│ │ • getStudentTotalChallengesCompletedInBlock
│ ├── checkIfStudentHasProgressDataForSuperblocksSelectedByTeacher.js
│ ├── extractTimestamps.js (2 functions)
│ │ • extractStudentCompletionTimestamps
│ │ • extractFilteredCompletionTimestamps
│ ├── fetchStudentData.js
│ └── getIndividualStudentData.js
└── legacy/ # Deprecated v9-incompatible (3 files)
├── getDashedNamesURLs.js
├── getNonDashedNamesURLs.js
└── getSuperBlockJsons.js
Total: 14 new organized files from 16 functions in the original monolithic file
6 files updated with new import paths (no logic changes):
components/DetailsDashboard.jscomponents/DetailsDashboardList.jscomponents/dashtable_v2.jspages/dashboard/[id].jspages/dashboard/v2/[id].jspages/dashboard/v2/details/[id]/[studentEmail].js
All changes: Only import statements updated to point to new file locations
- Easy to Find: Instead of searching through 419 lines, go directly to the file you need
- Clear Organization: Related functions grouped by domain (curriculum, student, dashboard)
- No Breaking Changes: Original file preserved, only imports updated
- Maintainability: One function per file = easier to understand and modify
- Better Discoverability: File names match function names exactly
- ✅ ESLint: No errors
- ✅ Prettier: All files formatted
- ✅ Import Resolution: All imports validated
- ✅ Diff Review: Only import path changes, no logic modifications
- ✅ Comparison with main: Only functions from main's api_proccesor.js included
See mermaid.md for an interactive diagram showing:
- All organized folders and files
- Function dependencies
- Page/component imports
- Legacy function warnings
- Can be updated as needed.