Skip to content

Commit adf7bd9

Browse files
File changes
1 parent 9601bc5 commit adf7bd9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/pages/PredictiveAnalyticsDashboard.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ import PredictiveInsightsPanel from '../components/analytics/PredictiveInsightsP
1212
export default function PredictiveAnalyticsDashboard() {
1313
const [timeframe, setTimeframe] = useState('90');
1414

15+
// Query real entities
16+
const { data: burnoutRisks = [] } = useQuery({
17+
queryKey: ['burnout-risks'],
18+
queryFn: () => base44.entities.BurnoutRisk.list('-created_date', 1000),
19+
});
20+
21+
const { data: predictiveInsights = [] } = useQuery({
22+
queryKey: ['predictive-insights-dashboard'],
23+
queryFn: () => base44.entities.PredictiveInsight.list('-created_date', 1000),
24+
});
25+
26+
// Null-safe data and calculations
27+
const safeBurnoutRisks = burnoutRisks || [];
28+
const safeInsights = predictiveInsights || [];
29+
const atRiskCount = safeBurnoutRisks.filter(b => b.risk_level === 'high').length || 0;
30+
const totalInsightsCount = safeInsights.length || 0;
31+
1532
return (
1633
<div className="space-y-6">
1734
{/* Header */}

0 commit comments

Comments
 (0)