Skip to content

Commit

Permalink
Count EBaac countries differently
Browse files Browse the repository at this point in the history
We want to count all the submissions, not just the awarded ones.
  • Loading branch information
thomasleese committed May 16, 2024
1 parent e35d8fe commit 623448b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/lib/analytics/publication_extract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 623448b

Please sign in to comment.