Sha256: 6e65fdd48173a8cf2d2083606eb5d6135ac2e7d8fa37c7373129b0956af5689f

Contents?: true

Size: 791 Bytes

Versions: 8

Compression:

Stored size: 791 Bytes

Contents

module Solvable
  def submit_solution!(user, attributes={})
    assignment, _ = find_assignment_and_submit! user, attributes[:content].to_mumuki_solution(language)
    try_solve_discussions(user) if assignment.solved?
    assignment
  end

  def run_tests!(params)
    language.run_tests!(params.merge(locale: locale, expectations: expectations, custom_expectations: custom_expectations))
  end
end

class NilClass
  def to_mumuki_solution(language)
    Mumuki::Domain::Submission::Solution.new
  end
end

class String
  def to_mumuki_solution(language)
    Mumuki::Domain::Submission::Solution.new content: normalize_whitespaces
  end
end

class Hash
  def to_mumuki_solution(language)
    language
      .directives_sections
      .join(self)
      .to_mumuki_solution(language)
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
mumuki-domain-7.6.1 app/models/concerns/submittable/solvable.rb
mumuki-domain-7.6.0 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-7.5.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-ad16a5930cec/app/models/concerns/submittable/solvable.rb
mumuki-laboratory-7.5.1 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-a059418e5fd8/app/models/concerns/submittable/solvable.rb
mumuki-domain-7.5.1 app/models/concerns/submittable/solvable.rb
mumuki-laboratory-7.5.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-acb12583b793/app/models/concerns/submittable/solvable.rb
mumuki-domain-7.5.0 app/models/concerns/submittable/solvable.rb
mumuki-domain-7.4.1 app/models/concerns/submittable/solvable.rb