Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Nov 19, 2025

This PR enhances the hackathon and company dashboards by updating hackathon data structures and introducing new aggregated metrics for company analytics.

🔧 Key Changes

1. Hackathon Schema & Display Improvements

  • Updated hackathon data schema to include new metadata fields
  • Improved display structure for rendering hackathon details in the UI
  • Ensures consistency across dashboard, listings, and analytics views

2. Company Metrics Enhancements

  • Added total hackathons count for each company
  • Introduced total participants metric aggregated across all company hackathons
  • Improved backend logic for data fetching and aggregation

📁 Files Updated

  • 6 files changed
  • 2 commits included

🛠 Stability Notes

  • No breaking API changes
  • Enhances analytics correctness
  • Improves UI clarity and admin/company insights

Authored by: @akshay0611

Summary by CodeRabbit

  • New Features

    • Company profiles now display hackathon event counts alongside traditional event statistics
    • Added total participants metric aggregating all registrations across company events and hackathons
    • Improved hackathon event details display with reorganized information layout for greater clarity
  • Updates

    • Enhanced data structure to reliably track and report comprehensive company-wide statistics

- Consolidate start_date and end_date into single date field
- Add registration_deadline field for tracking registration cutoff
- Make location, mode, organizer, and team size fields optional
- Replace registered_teams and max_teams with registered and capacity fields
- Add total_registrations and duration fields to hackathon interface
- Update date display to show full year and handle invalid dates with "TBA" fallback
- Change duration display from calculated days to registration deadline or duration field
- Update location display to prioritize location over mode with fallback
- Simplify team registration display to show total registered count
- Improve date validation with isNaN checks before formatting
…ny profiles

- Add approved hackathons count to company API endpoint and service layer
- Calculate total participants across both events and hackathons
- Update CompanyCard to display hackathons count alongside events
- Update CompanyProfile stats to show approved hackathons and total participants
- Add approved_hackathons_count field to Company type definition
- Rename "Registrations" label to "Participants" for clarity in company profile
- Enrich company data with calculated fields in both API and service methods
@vercel
Copy link

vercel bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Building Building Preview Comment Nov 19, 2025 9:08am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The PR extends company metrics to track hackathons alongside events. It adds approved_hackathons_count and total_participants (computed as the sum of event and hackathon registrations) throughout the API, service layer, type definitions, and UI components. The Hackathon interface schema is also restructured with renamed and optional fields.

Changes

Cohort / File(s) Change Summary
API & Service Layer
app/api/companies/[slug]/route.ts, lib/services/company-service.ts
Fetch approved hackathons and event/hackathon registrations; compute total_participants as sum of both; enrich company object with approved_hackathons_count and total_participants; update caching and API response.
Type Definitions
types/company.ts
Add optional approved_hackathons_count field to Company interface.
UI Components
components/companies/CompanyCard.tsx, components/companies/CompanyProfile.tsx
Display approved_hackathons_count alongside events; use total_participants with null-coalescing defaults; update "Registrations" label to "Participants".
Hackathon Page
app/companies/[slug]/hackathons/page.tsx
Restructure Hackathon interface: rename start_date → date (remove end_date), make location/mode/max_team_size/min_team_size optional, rename registered_teams → registered and max_teams → capacity, add total_registrations and duration fields; update rendering logic for date, registration deadline, location, and team count display with fallbacks.

Sequence Diagram

sequenceDiagram
    participant API as GET /companies/[slug]
    participant Service as company-service
    participant DB as Database
    participant Component as UI Component

    API->>Service: enrichCompany(slug)
    Service->>DB: fetch company details
    Service->>DB: fetch approved events for company
    Service->>DB: fetch approved hackathons for company
    Note over Service: Calculate totals:<br/>event_registered_count +<br/>hackathon_registered_count
    Service->>Service: Compute:<br/>approved_events_count<br/>approved_hackathons_count<br/>total_participants
    Service->>Service: Enrich company object<br/>with new fields
    Service-->>API: return enriched company
    API-->>Component: JSON response
    Component->>Component: Display approved_events_count<br/>+ approved_hackathons_count<br/>+ total_participants
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

  • Hackathon interface restructuring (app/companies/[slug]/hackathons/page.tsx): Multiple field renamings and optionality changes require verification of all consumers and rendering logic adjustments.
  • Data enrichment logic (app/api/companies/[slug]/route.ts, lib/services/company-service.ts): Verify that approved_hackathons_count and total_participants are computed correctly; confirm caching invalidation and consistency.
  • Component field access: Ensure all component usages of the Company type (new fields) and updated Hackathon interface are consistent with the schema changes.

Possibly related PRs

Poem

🐰 A hackathon's hop, events now paired,
Participants counted, metrics declared,
Interfaces dance in restructured form,
Dashboard enriched, the new data norm.
Count them all—events, hacks, and more! 🎉

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/hackathon

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab5cea5 and 1a7b0d5.

📒 Files selected for processing (6)
  • app/api/companies/[slug]/route.ts (1 hunks)
  • app/companies/[slug]/hackathons/page.tsx (2 hunks)
  • components/companies/CompanyCard.tsx (1 hunks)
  • components/companies/CompanyProfile.tsx (1 hunks)
  • lib/services/company-service.ts (2 hunks)
  • types/company.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

3 participants