88 CACHE_KEY_DONATION_TOWARDS_GOAL_PERCENT ,
99 CACHE_KEY_DONATIONS_TOTAL_AMOUNT ,
1010 CACHE_KEY_DONORS_COUNT ,
11+ CACHE_KEY_HISTORICAL_COMPARISON ,
1112 CACHE_KEY_SPONSORSHIP_BREAKDOWN ,
1213 CACHE_KEY_SPONSORSHIP_COMMITTED ,
1314 CACHE_KEY_SPONSORSHIP_COMMITTED_COUNT ,
2728 CACHE_KEY_VOLUNTEER_SIGNUPS_COUNT ,
2829 DONATION_GOAL_AMOUNT ,
2930 DONATIONS_GOAL ,
31+ HISTORICAL_STATS ,
32+ PROPOSALS_2025_COUNT ,
3033 SPONSORSHIP_GOAL ,
3134 SPONSORSHIP_GOAL_AMOUNT ,
3235 STATS_CACHE_TIMEOUT ,
@@ -49,6 +52,7 @@ def get_stats_cached_values():
4952 stats_dict .update (get_sponsorships_stats_dict ())
5053 stats_dict .update (get_donations_stats_dict ())
5154 stats_dict .update (get_attendee_stats_dict ())
55+ stats_dict [CACHE_KEY_HISTORICAL_COMPARISON ] = get_historical_comparison_data ()
5256 return stats_dict
5357
5458
@@ -610,3 +614,142 @@ def get_attendee_stats_dict():
610614 stats_dict = {}
611615 stats_dict [CACHE_KEY_ATTENDEE_COUNT ] = get_attendee_count_cache ()
612616 return stats_dict
617+
618+
619+ def get_historical_comparison_data ():
620+ """
621+ Returns historical comparison data for charts showing progress over the years.
622+ Combines hardcoded historical data with current year's data.
623+ """
624+ historical_comparison = cache .get (CACHE_KEY_HISTORICAL_COMPARISON )
625+ if not historical_comparison :
626+ # Get current year data
627+ current_registrations = get_attendee_count_cache ()
628+ current_sponsors = get_sponsorship_total_count_stats_cache ()
629+ current_sponsorship_amount = get_sponsorship_committed_amount_stats_cache ()
630+ current_donors = get_donors_count_cache ()
631+ current_donation_amount = get_total_donations_amount_cache ()
632+
633+ # Build comparison data structure
634+ historical_comparison = []
635+
636+ # Registrations comparison
637+ historical_comparison .append (
638+ {
639+ "title" : "Registrations Over the Years" ,
640+ "columns" : [["string" , "Year" ], ["number" , "Registrations" ]],
641+ "data" : [
642+ ["2023" , HISTORICAL_STATS ["2023" ]["registrations" ]],
643+ ["2024" , HISTORICAL_STATS ["2024" ]["registrations" ]],
644+ ["2025" , current_registrations ],
645+ ],
646+ "chart_id" : "registrations_comparison" ,
647+ "chart_type" : "bar" ,
648+ }
649+ )
650+
651+ # Proposals comparison
652+ historical_comparison .append (
653+ {
654+ "title" : "Proposals Over the Years" ,
655+ "columns" : [["string" , "Year" ], ["number" , "Proposals" ]],
656+ "data" : [
657+ ["2023" , HISTORICAL_STATS ["2023" ]["proposals" ]],
658+ ["2024" , HISTORICAL_STATS ["2024" ]["proposals" ]],
659+ ["2025" , PROPOSALS_2025_COUNT ],
660+ ],
661+ "chart_id" : "proposals_comparison" ,
662+ "chart_type" : "bar" ,
663+ }
664+ )
665+
666+ # Sponsors comparison
667+ historical_comparison .append (
668+ {
669+ "title" : "Number of Sponsors Over the Years" ,
670+ "columns" : [["string" , "Year" ], ["number" , "Sponsors" ]],
671+ "data" : [
672+ ["2023" , HISTORICAL_STATS ["2023" ]["sponsors" ]],
673+ ["2024" , HISTORICAL_STATS ["2024" ]["sponsors" ]],
674+ ["2025" , current_sponsors ],
675+ ],
676+ "chart_id" : "sponsors_comparison" ,
677+ "chart_type" : "bar" ,
678+ }
679+ )
680+
681+ # Sponsorship amount comparison
682+ historical_comparison .append (
683+ {
684+ "title" : "Sponsorship Amount Over the Years" ,
685+ "columns" : [["string" , "Year" ], ["number" , "Amount (USD)" ]],
686+ "data" : [
687+ ["2023" , HISTORICAL_STATS ["2023" ]["sponsorship_amount" ]],
688+ ["2024" , HISTORICAL_STATS ["2024" ]["sponsorship_amount" ]],
689+ ["2025" , current_sponsorship_amount ],
690+ ],
691+ "chart_id" : "sponsorship_amount_comparison" ,
692+ "chart_type" : "bar" ,
693+ }
694+ )
695+
696+ # Individual donations comparison
697+ historical_comparison .append (
698+ {
699+ "title" : "Number of Individual Donors Over the Years" ,
700+ "columns" : [["string" , "Year" ], ["number" , "Donors" ]],
701+ "data" : [
702+ ["2023" , HISTORICAL_STATS ["2023" ]["donors" ]],
703+ ["2024" , HISTORICAL_STATS ["2024" ]["donors" ]],
704+ ["2025" , current_donors ],
705+ ],
706+ "chart_id" : "donors_comparison" ,
707+ "chart_type" : "bar" ,
708+ }
709+ )
710+
711+ # Donation amount comparison
712+ historical_comparison .append (
713+ {
714+ "title" : "Donation Amount Over the Years" ,
715+ "columns" : [["string" , "Year" ], ["number" , "Amount (USD)" ]],
716+ "data" : [
717+ ["2023" , HISTORICAL_STATS ["2023" ]["donation_amount" ]],
718+ ["2024" , HISTORICAL_STATS ["2024" ]["donation_amount" ]],
719+ ["2025" , current_donation_amount ],
720+ ],
721+ "chart_id" : "donation_amount_comparison" ,
722+ "chart_type" : "bar" ,
723+ }
724+ )
725+
726+ # Total proceeds comparison
727+ historical_comparison .append (
728+ {
729+ "title" : "Total Proceeds Over the Years" ,
730+ "columns" : [["string" , "Year" ], ["number" , "Amount (USD)" ]],
731+ "data" : [
732+ [
733+ "2023" ,
734+ HISTORICAL_STATS ["2023" ]["sponsorship_amount" ]
735+ + HISTORICAL_STATS ["2023" ]["donation_amount" ],
736+ ],
737+ [
738+ "2024" ,
739+ HISTORICAL_STATS ["2024" ]["sponsorship_amount" ]
740+ + HISTORICAL_STATS ["2024" ]["donation_amount" ],
741+ ],
742+ ["2025" , current_sponsorship_amount + current_donation_amount ],
743+ ],
744+ "chart_id" : "proceeds_comparison" ,
745+ "chart_type" : "bar" ,
746+ }
747+ )
748+
749+ cache .set (
750+ CACHE_KEY_HISTORICAL_COMPARISON ,
751+ historical_comparison ,
752+ STATS_CACHE_TIMEOUT ,
753+ )
754+
755+ return historical_comparison
0 commit comments