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 @@ -90,6 +90,23 @@ export default function AdvancedGamificationAnalytics() {
9090 refetchPoints ( ) ;
9191 } ;
9292
93+ // Null-safe data
94+ const safeRules = gamificationRules || [ ] ;
95+ const safeExecutions = ruleExecutions || [ ] ;
96+ const safeABTests = abTests || [ ] ;
97+
98+ // Key metrics
99+ const activeRulesCount = safeRules . filter ( r => r . is_active === true ) . length || 0 ;
100+ const totalRuleExecutions = safeExecutions . length || 0 ;
101+ const activeABTests = safeABTests . filter ( t => t . status === 'running' ) . length || 0 ;
102+
103+ // Recent rule executions table data
104+ const recentExecutions = safeExecutions . slice ( 0 , 10 ) . map ( ex => ( {
105+ rule_name : ex . rule_name || 'Unknown' ,
106+ executed_date : ex . created_date ,
107+ success : ex . success === true ? 'Success' : 'Failed'
108+ } ) ) ;
109+
93110 const handleExport = ( ) => {
94111 // Generate CSV export
95112 const data = userPoints . map ( up => ( {
You can’t perform that action at this time.
0 commit comments