Class: Problem
- Inherits:
-
QueriableChallenge
- Object
- ActiveRecord::Base
- ApplicationRecord
- Exercise
- Challenge
- QueriableChallenge
- Problem
- Includes:
- Solvable, WithEditor, WithExpectations
- Defined in:
- app/models/exercise/problem.rb
Constant Summary
Constants inherited from Exercise
Exercise::BASIC_RESOURCE_FIELDS, Exercise::RANDOMIZED_FIELDS
Instance Method Summary collapse
- #automated_evaluation? ⇒ Boolean
- #custom_expectations ⇒ Object
- #evaluation_class ⇒ Object
- #evaluation_criteria? ⇒ Boolean
- #expectations ⇒ Object
- #expectations? ⇒ Boolean
-
#layout=(layout) ⇒ Object
Sets the layout.
- #mixed_evaluation? ⇒ Boolean
- #own_custom_expectations ⇒ Object
- #own_expectations ⇒ Object
- #reset! ⇒ Object
- #save_query_results!(assignment) ⇒ Object
- #save_query_submission!(_assignment, _submission) ⇒ Object
Methods included from WithExpectations
#ensure_expectations_format, #expectations=, #expectations_yaml, #expectations_yaml=, #raw_expectations
Methods included from WithEditor
#choice?, #editor_with_defaults?, #pretty_choices
Methods included from Solvable
#run_tests!, #solution_for, #submit_solution!
Methods included from Queriable
Methods inherited from Challenge
Methods included from WithLayout
Methods inherited from Exercise
#choice?, #choice_index_for, #choice_values, #console?, #content_used_in?, #custom?, default_scope, #description_context, #description_task, #ensure_type!, #files_for, find_transparently!, #friendly, #guide_done_for?, #import_from_resource_h!, #inspection_keywords, #limited?, locate!, #navigable_content_in, #new_solution, #pending_siblings_for, #previous, #reclassify!, #results_hidden?, #search_tags, #settings, #sibling_at, #solvable?, #splitted_description, #structural_parent, #submission_for, #to_expanded_resource_h, #to_resource_h, #transparent_id, #transparent_params, #try_submit_solution!, #used_in?
Methods included from SiblingsNavigation
#navigable_name, #next_for, #pending_siblings_for, #restart, #siblings
Methods included from ParentNavigation
#leave, #navigable_name, #navigable_parent, #navigation_end?
Methods included from Submittable
#find_assignment_and_submit!, #submit!
Methods included from Questionable
Methods included from WithAssignments
#assignment_for, #find_assignment_for, #has_messages_for?, #has_progress_for?, #messages_for, #status_for
Methods included from FriendlyName
Methods included from Assistable
Methods included from WithRandomizations
#randomizer, #seed, #seed_with!
Methods included from WithDiscussions
#discuss!, #new_discussion_for, #submission_for, #try_solve_discussions!
Methods inherited from ApplicationRecord
active_between, aggregate_of, all_except, defaults, #delete, #destroy!, enum_prefixed_translations_for, numbered, organic_on, resource_fields, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, teaser_on, #update_and_notify!, update_or_create!, whitelist_attributes, with_pg_retry, with_temporary_token
Methods included from WithPgLock
Instance Method Details
#automated_evaluation? ⇒ Boolean
43 44 45 |
# File 'app/models/exercise/problem.rb', line 43 def automated_evaluation? expectations? || test.present? end |
#custom_expectations ⇒ Object
31 32 33 |
# File 'app/models/exercise/problem.rb', line 31 def custom_expectations "#{own_custom_expectations}\n#{guide.custom_expectations}" end |
#evaluation_class ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'app/models/exercise/problem.rb', line 51 def evaluation_class if mixed_evaluation? Mumuki::Domain::Evaluation::Mixed elsif manual_evaluation? Mumuki::Domain::Evaluation::Manual else Mumuki::Domain::Evaluation::Automated end end |
#evaluation_criteria? ⇒ Boolean
35 36 37 |
# File 'app/models/exercise/problem.rb', line 35 def evaluation_criteria? manual_evaluation? || automated_evaluation? end |
#expectations ⇒ Object
27 28 29 |
# File 'app/models/exercise/problem.rb', line 27 def expectations own_expectations + guide.expectations end |
#expectations? ⇒ Boolean
47 48 49 |
# File 'app/models/exercise/problem.rb', line 47 def expectations? own_expectations.present? || own_custom_expectations.present? end |
#layout=(layout) ⇒ Object
Sets the layout. This method accepts input_kids as a synonym of input_primary for historical reasons
63 64 65 |
# File 'app/models/exercise/problem.rb', line 63 def layout=(layout) self[:layout] = layout.like?(:input_kids) ? :input_primary : layout end |
#mixed_evaluation? ⇒ Boolean
39 40 41 |
# File 'app/models/exercise/problem.rb', line 39 def mixed_evaluation? manual_evaluation? && automated_evaluation? end |
#own_custom_expectations ⇒ Object
25 |
# File 'app/models/exercise/problem.rb', line 25 alias_method :own_custom_expectations, :custom_expectations |
#own_expectations ⇒ Object
24 |
# File 'app/models/exercise/problem.rb', line 24 alias_method :own_expectations, :expectations |
#reset! ⇒ Object
18 19 20 21 22 |
# File 'app/models/exercise/problem.rb', line 18 def reset! super self.test = nil self.expectations = [] end |
#save_query_results!(assignment) ⇒ Object
15 16 |
# File 'app/models/exercise/problem.rb', line 15 def save_query_results!(assignment) end |
#save_query_submission!(_assignment, _submission) ⇒ Object
12 13 |
# File 'app/models/exercise/problem.rb', line 12 def save_query_submission!(_assignment, _submission) end |