Class: Quby::Compiler::Entities::OutcomeTable
- Inherits:
-
Object
- Object
- Quby::Compiler::Entities::OutcomeTable
- Includes:
- ActiveModel::Model
- Defined in:
- lib/quby/compiler/entities/outcome_table.rb
Overview
OutcomeTable describes how scores are formatted in a table in outcome views
Instance Attribute Summary collapse
-
#default_collapsed ⇒ Object
Returns the value of attribute default_collapsed.
-
#key ⇒ Object
Returns the value of attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
-
#questionnaire ⇒ Object
Returns the value of attribute questionnaire.
-
#score_keys ⇒ Object
Returns the value of attribute score_keys.
-
#subscore_keys ⇒ Object
Returns the value of attribute subscore_keys.
Instance Method Summary collapse
Instance Attribute Details
#default_collapsed ⇒ Object
Returns the value of attribute default_collapsed.
13 14 15 |
# File 'lib/quby/compiler/entities/outcome_table.rb', line 13 def default_collapsed @default_collapsed end |
#key ⇒ Object
Returns the value of attribute key.
13 14 15 |
# File 'lib/quby/compiler/entities/outcome_table.rb', line 13 def key @key end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/quby/compiler/entities/outcome_table.rb', line 13 def name @name end |
#questionnaire ⇒ Object
Returns the value of attribute questionnaire.
13 14 15 |
# File 'lib/quby/compiler/entities/outcome_table.rb', line 13 def questionnaire @questionnaire end |
#score_keys ⇒ Object
Returns the value of attribute score_keys.
13 14 15 |
# File 'lib/quby/compiler/entities/outcome_table.rb', line 13 def score_keys @score_keys end |
#subscore_keys ⇒ Object
Returns the value of attribute subscore_keys.
13 14 15 |
# File 'lib/quby/compiler/entities/outcome_table.rb', line 13 def subscore_keys @subscore_keys end |
Instance Method Details
#no_outcome_tables_defined_in_score_schemas ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# 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 ⇒ Object
20 21 22 23 24 25 26 27 28 |
# 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 |