From 623448b7c9579af76bc38c72ffd160b32b94f21d Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Thu, 16 May 2024 12:27:15 +0100 Subject: [PATCH] Count EBaac countries differently We want to count all the submissions, not just the awarded ones. --- app/lib/analytics/publication_extract.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/lib/analytics/publication_extract.rb b/app/lib/analytics/publication_extract.rb index 008a9e979c..0b6e4e271a 100644 --- a/app/lib/analytics/publication_extract.rb +++ b/app/lib/analytics/publication_extract.rb @@ -18,7 +18,7 @@ def call declines = declined_application_forms(country) withdraws = withdrawn_application_forms(country) - awarded = awards.count + submissions_with_subjects = submissions.where.not(subjects: []) induction_required = awards @@ -27,32 +27,32 @@ def call percent_induction_required = ( - if awarded.zero? + if awards.empty? 0 else - ((induction_required.to_f / awarded) * 100).round + ((induction_required.to_f / awards.count) * 100).round end ) { country_name: CountryName.from_country(country), applications: submissions.count, - assessed: awarded + declines.count, - awarded:, + assessed: awards.count + declines.count, + awarded: awards.count, declined: declines.count, withdrawn: withdraws.count, awaiting_decision: - submissions.count - awarded - declines.count - withdraws.count, + submissions.count - awards.count - declines.count - withdraws.count, awardees_with_only_ebacc_subject_or_subjects: - awards.count do |application_form| + submissions_with_subjects.count do |application_form| has_only_ebacc_subjects?(application_form) end, awardees_with_no_ebacc_subjects: - awards.count do |application_form| + submissions_with_subjects.count do |application_form| has_no_ebacc_subjects?(application_form) end, awardees_with_a_mix_of_subjects_at_least_one_is_ebacc: - awards.count do |application_form| + submissions_with_subjects.count do |application_form| !has_only_ebacc_subjects?(application_form) && !has_no_ebacc_subjects?(application_form) end,