Module: Solvable
- Included in:
- Problem
- Defined in:
- app/models/concerns/submittable/solvable.rb
Instance Method Summary collapse
- #run_tests!(params) ⇒ Object
- #solution_for(submission_attributes) ⇒ Object
- #submit_solution!(user, submission_attributes = {}) ⇒ Object
Instance Method Details
#run_tests!(params) ⇒ Object
8 9 10 |
# File 'app/models/concerns/submittable/solvable.rb', line 8 def run_tests!(params) language.run_tests!(params.merge(locale: locale, expectations: expectations, custom_expectations: custom_expectations)) end |
#solution_for(submission_attributes) ⇒ Object
12 13 14 15 16 |
# File 'app/models/concerns/submittable/solvable.rb', line 12 def solution_for(submission_attributes) submission_attributes[:content] .to_mumuki_solution(language) .with_client_result(submission_attributes[:client_result]) end |
#submit_solution!(user, submission_attributes = {}) ⇒ Object
2 3 4 5 6 |
# File 'app/models/concerns/submittable/solvable.rb', line 2 def submit_solution!(user, submission_attributes={}) assignment, _ = find_assignment_and_submit! user, solution_for(submission_attributes) try_solve_discussions!(user) if assignment.solved? assignment end |