Class: Mumuki::Domain::Submission::Try
- Inherits:
-
ConsoleSubmission
- Object
- Base
- ConsoleSubmission
- Mumuki::Domain::Submission::Try
- Defined in:
- lib/mumuki/domain/submission/try.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#cookie ⇒ Object
Returns the value of attribute cookie.
-
#query ⇒ Object
Returns the value of attribute query.
Attributes inherited from Base
Instance Method Summary collapse
- #save_results!(results, assignment) ⇒ Object
- #save_submission!(assignment) ⇒ Object
- #try_evaluate_query!(assignment) ⇒ Object
Methods inherited from ConsoleSubmission
#format_query_result!, #try_evaluate!
Methods inherited from Base
#dry_run!, #evaluate!, from_attributes, #id, mapping_attributes, #run!, #with_client_result
Instance Attribute Details
#cookie ⇒ Object
Returns the value of attribute cookie.
2 3 4 |
# File 'lib/mumuki/domain/submission/try.rb', line 2 def @cookie end |
#query ⇒ Object
Returns the value of attribute query.
2 3 4 |
# File 'lib/mumuki/domain/submission/try.rb', line 2 def query @query end |
Instance Method Details
#save_results!(results, assignment) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/mumuki/domain/submission/try.rb', line 15 def save_results!(results, assignment) changes = { status: results[:status], result: results[:result] } changes.merge! query_results: assignment.query_results.insert_last(results[:query_result]) if results[:query_result] assignment.update! changes end |
#save_submission!(assignment) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/mumuki/domain/submission/try.rb', line 8 def save_submission!(assignment) assignment.query_results = [] if .blank? assignment.queries = .insert_last(query) assignment.save_submission! self assignment.save! end |
#try_evaluate_query!(assignment) ⇒ Object
4 5 6 |
# File 'lib/mumuki/domain/submission/try.rb', line 4 def try_evaluate_query!(assignment) assignment.run_try!(query: query, cookie: ).except(:response_type) end |