diff --git a/server/hedley/modules/custom/hedley_restful/plugins/restful/node/HedleyRestfulSync.class.php b/server/hedley/modules/custom/hedley_restful/plugins/restful/node/HedleyRestfulSync.class.php index 91e51e7d52..a079227601 100644 --- a/server/hedley/modules/custom/hedley_restful/plugins/restful/node/HedleyRestfulSync.class.php +++ b/server/hedley/modules/custom/hedley_restful/plugins/restful/node/HedleyRestfulSync.class.php @@ -319,10 +319,17 @@ public function getForHealthCenterStatistics($uuid) { $cached_hash = hedley_stats_handle_cache(HEDLEY_STATS_CACHE_GET, HEDLEY_STATS_SYNC_STATS_CACHE, $health_center_id); if (empty($cached_hash)) { // There's no cached data for health center - trigger statistics - // calculation by adding an AQ item. - hedley_general_add_task_to_advanced_queue_by_id(HEDLEY_STATS_CALCULATE_STATS, $health_center_id, [ - 'health_center_nid' => $health_center_id, - ]); + // calculation, unless health center is member of exclusion list. + $excluded_health_centers = variable_get('hedley_statistics_excluded_health_centers', ''); + $excluded_health_centers = explode(',', $excluded_health_centers); + if (array_search($health_center_id, $excluded_health_centers) === FALSE) { + // This health center is not excluded - trigger statistics calculation + // by adding an AQ item. + hedley_general_add_task_to_advanced_queue_by_id(HEDLEY_STATS_CALCULATE_STATS, $health_center_id, [ + 'health_center_nid' => $health_center_id, + ]); + } + return $return; } diff --git a/server/hedley/modules/custom/hedley_stats/hedley_stats.module b/server/hedley/modules/custom/hedley_stats/hedley_stats.module index 8e0ea0f3e0..ec9223e403 100644 --- a/server/hedley/modules/custom/hedley_stats/hedley_stats.module +++ b/server/hedley/modules/custom/hedley_stats/hedley_stats.module @@ -335,9 +335,7 @@ function hedley_stats_calculate_stats_for_health_center($health_center_id) { // Get all clinics of type 'FBF' for the HC. $fbf_clinics = hedley_health_center_get_clinics_by_health_center($health_center_id, 'fbf'); // Calculate statistics that are provided for FBF clinics only. - if (!empty($fbf_clinics)) { - hedley_stats_get_session_attendance_stats_by_health_center($health_center_id, $fbf_clinics); - } + hedley_stats_get_session_attendance_stats_by_health_center($health_center_id, $fbf_clinics); $villages_with_residents = hedley_stats_get_villages_with_residents($health_center_id);