class Quby::Compiler::Entities::OutcomeTable
OutcomeTable
describes how scores are formatted in a table in outcome views @param key [Symbol] key to reference this outcome table by @param score_keys
[Array<Symbol>] which scores are selected for the rows of the table @param subscore_keys
[Array<Symbol>] which subscores (:value, :interpretation etc.) make up the table columns @param name [String] a title that will be shown above the table @param default_collapsed
[Boolean] if true, collapses the table to only show the name by default @param questionnaire [Questionnaire] for validating score keys and subscore keys according to its score_schema
Attributes
default_collapsed[RW]
key[RW]
name[RW]
questionnaire[RW]
score_keys[RW]
subscore_keys[RW]
Public Instance Methods
no_outcome_tables_defined_in_score_schemas()
click to toggle source
# File lib/quby/compiler/entities/outcome_table.rb, line 30 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
references_existing_score_keys()
click to toggle source
# File lib/quby/compiler/entities/outcome_table.rb, line 20 def references_existing_score_keys (score_keys - questionnaire.score_schemas.values.map(&:key)).each do |missing_key| errors.add :score_keys, "#{missing_key.inspect} not found in score schemas" end existing_subscore_keys = questionnaire.score_schemas.values.flat_map(&:subscore_schemas).map(&:key) (subscore_keys - existing_subscore_keys).each do |missing_key| errors.add :subscore_keys, "#{missing_key.inspect} not found in subscore schemas" end end