Sha256: c3073f8e6766dd3740b39ead47ec29e02d570796cc248df0f0c5d85011a689c0

Contents?: true

Size: 883 Bytes

Versions: 67

Compression:

Stored size: 883 Bytes

Contents

class ExerciseSolutionsController < AjaxController
  include Mumuki::Laboratory::Controllers::NestedInExercise
  include Mumuki::Laboratory::Controllers::ResultsRendering
  include Mumuki::Laboratory::Controllers::ExerciseSeed

  before_action :set_messages, only: :create
  before_action :validate_accessible!, only: :create

  def create
    assignment = @exercise.try_submit_solution!(current_user, solution_params)
    render_results_json assignment, status: assignment.status
  end

  private

  def accessible_subject
    @exercise.navigable_parent
  end

  def set_messages
    @messages = @exercise.messages_for(current_user)
  end

  def solution_params
    {
      content: params.require(:solution).permit!.to_h[:content],
      client_result: params[:client_result].try { |it| it.permit(:status, test_results: [:title, :status, :result, :summary]).to_h }
    }
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
mumuki-laboratory-9.13.2 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.13.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.13.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.12.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.12.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.11.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.10.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.9.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.8.2 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.8.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.8.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.7.2 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.7.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.7.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.6.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.5.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.5.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.4.1 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.4.0 app/controllers/exercise_solutions_controller.rb
mumuki-laboratory-9.3.1 app/controllers/exercise_solutions_controller.rb