@@ -723,11 +723,11 @@ def prepare_general_context(self, web_page_type, **kwargs):
723723 form_to_date_string = form .data ['to_date' ]
724724 to_date = convert_form_date_to_obpapi_datetime_format (form_to_date_string )
725725
726- self ._daily_and_weekly (web_page_type , is_included_obp_apps , to_date , exclude_app_names )
726+ ( per_hour_chart , per_day_chart ) = self ._daily_and_weekly (web_page_type , is_included_obp_apps , to_date , exclude_app_names , per_hour_chart , per_day_chart )
727727
728- self ._monthly_and_quarterly (web_page_type , is_included_obp_apps , to_date , exclude_app_names )
728+ ( per_day_chart , per_month_chart ) = self ._monthly_and_quarterly (web_page_type , is_included_obp_apps , to_date , exclude_app_names , per_day_chart , per_month_chart )
729729
730- self ._yearly_and_custom (web_page_type , is_included_obp_apps , to_date , exclude_app_names )
730+ ( per_day_chart , per_month_chart ) = self ._yearly_and_custom (web_page_type , is_included_obp_apps , to_date , exclude_app_names , per_day_chart , per_month_chart )
731731
732732 api_host_name = API_HOST
733733 top_apps_using_warehouse = self .get_top_apps_using_warehouse (from_date , to_date , exclude_app_names )
@@ -781,7 +781,7 @@ def prepare_general_context(self, web_page_type, **kwargs):
781781 except Exception as err :
782782 error_once_only (self .request , err )
783783
784- def _daily_and_weekly (self , web_page_type , is_included_obp_apps , to_date , exclude_app_names ):
784+ def _daily_and_weekly (self , web_page_type , is_included_obp_apps , to_date , exclude_app_names , per_hour_chart , per_day_chart ):
785785 if (web_page_type == SummaryType .DAILY ):
786786 # for one day, the from_date is 1 day ago.
787787 from_date = return_to_days_ago (to_date , 1 )
@@ -794,7 +794,9 @@ def _daily_and_weekly(self, web_page_type, is_included_obp_apps, to_date, exclud
794794 calls_per_day_list , calls_per_day , date_list = self .calls_per_day (is_included_obp_apps , from_date , to_date , exclude_app_names )
795795 per_day_chart = self .plot_line_chart (calls_per_day , date_list , "day" )
796796
797- def _monthly_and_quarterly (self , web_page_type , is_included_obp_apps , to_date , exclude_app_names ):
797+ return (per_hour_chart , per_day_chart )
798+
799+ def _monthly_and_quarterly (self , web_page_type , is_included_obp_apps , to_date , exclude_app_names , per_day_chart , per_month_chart ):
798800 if (web_page_type == SummaryType .MONTHLY ):
799801 # for one month, the from_date is 30 days ago.
800802 from_date = return_to_days_ago (to_date , 30 )
@@ -807,7 +809,9 @@ def _monthly_and_quarterly(self, web_page_type, is_included_obp_apps, to_date, e
807809 calls_per_month_list , calls_per_month , month_list = self .calls_per_month (is_included_obp_apps , from_date , to_date , exclude_app_names )
808810 per_month_chart = self .plot_line_chart (calls_per_month , month_list , 'month' )
809811
810- def _yearly_and_custom (self , web_page_type , is_included_obp_apps , to_date , exclude_app_names ):
812+ return (per_day_chart , per_month_chart )
813+
814+ def _yearly_and_custom (self , web_page_type , is_included_obp_apps , to_date , exclude_app_names , per_month_chart , per_day_chart ):
811815 if (web_page_type == SummaryType .YEARLY ):
812816 from_date = return_to_days_ago (to_date , 365 )
813817 calls_per_month_list , calls_per_month , month_list = self .calls_per_month (is_included_obp_apps , from_date , to_date , exclude_app_names )
@@ -820,6 +824,8 @@ def _yearly_and_custom(self, web_page_type, is_included_obp_apps, to_date, exclu
820824 calls_per_day_list , calls_per_day , date_list = self .calls_per_day (is_included_obp_apps , from_date , to_date , exclude_app_names )
821825 per_day_chart = self .plot_line_chart (calls_per_day , date_list , "day" )
822826
827+ return (per_month_chart , per_day_chart )
828+
823829class YearlySummaryView (MonthlyMetricsSummaryView ):
824830 template_name = 'metrics/yearly_summary.html'
825831 def get_context_data (self , ** kwargs ): return self .prepare_general_context (SummaryType .YEARLY , ** kwargs )
0 commit comments