File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,23 @@ import PredictiveInsightsPanel from '../components/analytics/PredictiveInsightsP
1212export 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 */ }
You can’t perform that action at this time.
0 commit comments