Skip to content

Commit cccc288

Browse files
File changes
1 parent 5bbbb26 commit cccc288

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/pages/AdvancedGamificationAnalytics.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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 => ({

0 commit comments

Comments
 (0)