Skip to content

Commit

Permalink
Merge pull request #554 from TIP-Global-Health/issue-p-2995
Browse files Browse the repository at this point in the history
[Hotfix] Statistics generation fix
  • Loading branch information
anvmn authored Nov 22, 2022
2 parents c92b52c + 0fb9eb2 commit e9a865f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit e9a865f

Please sign in to comment.