Skip to content
Snippets Groups Projects

Serialize outcome tables from dsl calls into roqua.json

Merged Jorn van de Beek requested to merge jb_serialize_outcome_table_dsl into main
All threads resolved!
Files
5
@@ -15,6 +15,7 @@ module Quby
validates :score_keys, :subscore_keys, :questionnaire, :key, presence: true
validates :name, presence: true, if: proc { |table| table.default_collapsed }
validate :references_existing_score_keys
validate :no_outcome_tables_defined_in_score_schemas
def references_existing_score_keys
(score_keys - questionnaire.score_schemas.values.map(&:key)).each do |missing_key|
@@ -25,6 +26,17 @@ module Quby
errors.add :subscore_keys, "#{missing_key.inspect} not found in subscore schemas"
end
end
def no_outcome_tables_defined_in_score_schemas
if questionnaire.score_schemas.values.any? do |schema|
schema.subscore_schemas.any? do |subscore|
subscore.outcome_table != :main
end
end
errors.add :score_schemas,
"Outcome table associations defined in score schemas should not be combined with explicit outcome tables"
end
end
end
end
end
Loading