Skip to content

Feat/csv

Lakshy Yarlagadda requested to merge feat/csv into main
## Summary
This MR fixes CSV preseed flow so teams and members are auto-created after login.

## Problem
Teams were not getting pre-created even though CSV files existed in `public/assets`.

## Root Cause
- `team_members.csv` parsing could crash when optional columns (like `team_name`) were missing.
- CSV fetch logic could accept non-CSV fallback responses (for example HTML with 200), causing silent empty parsing.
- Asset path resolution was fragile across different serving paths (`/`, `/dist`, relative).

## Changes Made
- Added robust CSV preload flow in `src/App.tsx`:
  - Loads `interns.csv`, `teams.csv`, `team_members.csv` in parallel.
  - Validates CSV payload headers before accepting response.
  - Uses multi-path asset fallback resolution for different hosting paths.
  - Merges preloaded interns into existing state and builds preloaded teams.
- Added/updated team seed parser in `src/utils/parseTeamSeedCSV.ts`:
  - Safe cell sanitization for optional/missing values.
  - Supports `team_id` and/or `team_name` based mapping.
  - Builds team list even with partial identifiers.
- Wired preloaded team state to dashboard:
  - `src/components/dashboard/DashboardHome.tsx`
  - `src/components/dashboard/TeamsDashboard.tsx`
- Added/updated seed CSVs:
  - `public/assets/teams.csv`
  - `public/assets/team_members.csv`
  - `public/assets/interns.csv`

## Verification
- `npm run build` passes.
- Local parser check confirms teams are generated from current CSV data.
- On login, Team Dashboard now receives preloaded teams instead of empty state.

## Notes
- Rows with blank `intern_id` in `team_members.csv` rely on name matching with `interns.csv`.
- If names do not match exactly, those members are skipped.

Merge request reports

Loading