Skip to content

Commit

Permalink
Merge pull request #2953 from bitzesty/auto-calc-rows
Browse files Browse the repository at this point in the history
Add default value for proportion on matrix question C5.1
  • Loading branch information
DaniBitZesty authored May 23, 2024
2 parents e8112ba + 411ebad commit 4c54492
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions forms/qae_form_builder/matrix_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def calculate_proportion(question_key, answers, x_heading, y_heading)
else
disadvantaged = answers["#{question_key}_#{x_heading}_total_disadvantaged"].to_f
end
disadvantaged ||= 0
total = answers["#{question_key}_#{x_heading}_calculated_total"].to_f
proportion = (disadvantaged.to_f / total * 100).round(2)
answers["#{question_key}_#{x_heading}_calculated_proportion"] = proportion
Expand Down

0 comments on commit 4c54492

Please sign in to comment.