Skip to content
Snippets Groups Projects
Commit 8517fc42 authored by Jorn van de Beek's avatar Jorn van de Beek
Browse files

Merge branch 'jb_outcome_table_nil' into 'main'

Allow outcome_table to be set to nil to hide values from outcome tables

See merge request !19
parents 7da764c2 4bf13d9c
No related branches found
No related tags found
1 merge request!19Allow outcome_table to be set to nil to hide values from outcome tables
Pipeline #91887 passed
2.7.1
2.7.2
......@@ -16,7 +16,8 @@ module Quby
attribute :calculation_key?, Types::Symbol
# [Optional argument] The name of the outcome table where this subscore should be shown. Used for cases where scores
# differ in subscores too much to be shown as one table. By default, all scores end up in the `:main` table.
attribute :outcome_table, Types::Symbol.default(:main).meta(omittable: true)
# When outcome_table is explicitly nil, the value should not be shown in outcome tables
attribute :outcome_table, Types::Symbol.optional.default(:main)
end
end
end
......
......@@ -91,6 +91,7 @@ module Quby
questionnaire.score_schemas.values.each do |schema|
schema.subscore_schemas.each do |subschema|
next if subschema.outcome_table.blank?
tables[subschema.outcome_table][:subscore_keys] << subschema.key
tables[subschema.outcome_table][:score_keys] << schema.key
headers[subschema.key] = subschema.label
......
......@@ -32,8 +32,19 @@ describe Quby::Compiler::Outputs::RoquaSerializer do
1
end
end
score_schema :score4, 'Score 4' do
subscore :value, 'Waarde', export_key: :score4, outcome_table: nil do
2
end
subscore :mean, 'Gemiddelde', export_key: :score4_m, outcome_table: :means do
1
end
end
end
serializer = described_class.new(questionnaire)
expect(serializer.as_json).to \
include({
outcome_tables_schema: {
......@@ -41,7 +52,7 @@ describe Quby::Compiler::Outputs::RoquaSerializer do
tables: {
main: {:score_keys => [:score0], :subscore_keys => [:something]},
values: {:score_keys => [:score1, :score2], :subscore_keys => [:value, :int]},
means: {:score_keys => [:score3], :subscore_keys => [:mean]}
means: {:score_keys => [:score3, :score4], :subscore_keys => [:mean]}
}
}
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment