@@ -15,27 +15,37 @@ export default function GamificationAnalytics() {
1515 const { user, loading : userLoading } = useUserData ( true , true ) ;
1616 const [ timeRange , setTimeRange ] = useState ( '30d' ) ;
1717
18- const { data : allUserPoints , isLoading : pointsLoading } = useQuery ( {
18+ const { data : allUserPoints = [ ] , isLoading : pointsLoading } = useQuery ( {
1919 queryKey : [ 'all-user-points' ] ,
2020 queryFn : ( ) => base44 . entities . UserPoints . list ( '-total_points' , 1000 ) ,
2121 } ) ;
2222
23- const { data : allRedemptions , isLoading : redemptionsLoading } = useQuery ( {
23+ const { data : allBadgeAwards = [ ] , isLoading : badgesLoading } = useQuery ( {
24+ queryKey : [ 'all-badge-awards' ] ,
25+ queryFn : ( ) => base44 . entities . BadgeAward . list ( '-created_date' , 1000 ) ,
26+ } ) ;
27+
28+ const { data : allChallengeParticipations = [ ] , isLoading : chalLoading } = useQuery ( {
29+ queryKey : [ 'challenge-participations' ] ,
30+ queryFn : ( ) => base44 . entities . ChallengeParticipation . list ( '-created_date' , 1000 ) ,
31+ } ) ;
32+
33+ const { data : allRedemptions = [ ] , isLoading : redemptionsLoading } = useQuery ( {
2434 queryKey : [ 'all-redemptions-analytics' ] ,
2535 queryFn : ( ) => base44 . entities . RewardRedemption . list ( '-created_date' , 1000 ) ,
2636 } ) ;
2737
28- const { data : pointsLedger , isLoading : ledgerLoading } = useQuery ( {
38+ const { data : pointsLedger = [ ] , isLoading : ledgerLoading } = useQuery ( {
2939 queryKey : [ 'points-ledger' , timeRange ] ,
3040 queryFn : ( ) => base44 . entities . PointsLedger . list ( '-created_date' , 5000 ) ,
3141 } ) ;
3242
33- const { data : allTiers , isLoading : tiersLoading } = useQuery ( {
43+ const { data : allTiers = [ ] , isLoading : tiersLoading } = useQuery ( {
3444 queryKey : [ 'all-tiers' ] ,
3545 queryFn : ( ) => base44 . entities . AchievementTier . filter ( { is_active : true } , 'order' ) ,
3646 } ) ;
3747
38- const { data : recognitions , isLoading : recognitionsLoading } = useQuery ( {
48+ const { data : recognitions = [ ] , isLoading : recognitionsLoading } = useQuery ( {
3949 queryKey : [ 'recognitions-analytics' ] ,
4050 queryFn : ( ) => base44 . entities . Recognition . list ( '-created_date' , 1000 ) ,
4151 } ) ;
0 commit comments