-
Notifications
You must be signed in to change notification settings - Fork 2
feat(company-dashboard): Integrate real hackathon & event metrics into analytics #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…type - Replace proportional view/click calculation with actual aggregated metrics from events and hackathons data - Calculate eventViews by summing views from all approved events - Calculate eventClicks by summing clicks from all approved events - Calculate hackathonViews by summing views from all approved hackathons - Calculate hackathonClicks by summing clicks from all approved hackathons - Update eventMetrics and hackathonMetrics to use actual calculated values instead of proportional estimates - Remove proportional ratio calculation logic that was previously used as a workaround - Improves accuracy of dashboard metrics by using real data instead of estimates based on item counts
- Add React state and useEffect hook to EventPerformanceComparison component to fetch real event data from API - Add React state and useEffect hook to HackathonPerformanceComparison component to fetch real hackathon data from API - Extract company slug from URL pathname to construct API endpoints dynamically - Filter approved events and hackathons before calculating performance metrics - Calculate total views, clicks, and registrations from actual event/hackathon records instead of analytics aggregates - Implement fallback to analytics data when API fetch fails or returns no data - Replace hardcoded metric calculations with dynamic API-driven data for more accurate dashboard reporting
- Add useEffect hook to fetch real-time event and hackathon statistics from API - Calculate actual views, clicks, and registrations from approved events and hackathons - Implement fallback to analytics data when actual stats are unavailable - Update AnalyticsCharts to use actual stats instead of analytics summary data - Update CompanyDashboard to calculate totalViews and totalClicks from events/hackathons - Rename analytics totals to analyticsTotals for clarity and distinction - Improve accuracy of dashboard metrics by using source-of-truth data from events and hackathons tables
…ical data - Calculate scaling factors to adjust historical analytics data to match current actual stats - Implement two-pass distribution algorithm to proportionally scale views and clicks - Floor proportional values in first pass to maintain data integrity - Distribute remaining views and clicks to days with highest fractional remainders - Remove remainder fields from final chart data for clean output - Ensures historical trends are preserved while reflecting current reality in analytics charts
- Add hackathon metadata (id, slug, title) to master_registrations table during registration - Include note clarifying integer to string conversion for activity_id - Create delete-test-company.js script for cleaning up test data - Script handles cascading deletion of events, hackathons, registrations, and analytics - Improves data tracking and provides utility for development/testing cleanup
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThis PR enriches hackathon registrations with metadata containing hackathon details, refactors dashboard analytics to directly aggregate views and clicks from events and hackathons APIs instead of proportional calculations, and adds a cascading deletion utility for test company data. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Dashboard Component
participant API as Events/Hackathons API
participant State as actualStats State
UI->>+API: Fetch events & hackathons
API-->>-UI: Return data with views/clicks
UI->>State: Update actualStats
Note over UI: First pass: Compute proportional<br/>distribution from historical data
Note over UI: Second pass: Distribute remainders<br/>to largest remainder days
UI->>UI: Generate chartData with<br/>remainder-adjusted values
UI->>UI: Render with actual totals
sequenceDiagram
participant Client as Registration Request
participant Route as /hackathons/[id]/register
participant DB as Database
Client->>+Route: POST registration
Route->>Route: Validate & check capacity
Route->>Route: Check duplicate registration
Route->>DB: Insert master_registrations<br/>with metadata
Note over Route: metadata = {<br/>hackathon_id,<br/>hackathon_slug,<br/>hackathon_title<br/>}
DB-->>Route: Record inserted
Route-->>-Client: Success response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
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. Comment |
Description
This PR improves how company dashboards handle real event and hackathon statistics by integrating accurate metrics and adding missing metadata.
Key Changes
Company Dashboard
Analytics
Hackathons
Why This Matters
Future Considerations
Authored by: @akshay0611
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Improvements