Sha256: 5b060f509421b06b30804d517bc5248ad91a95b2ca60e47f84f5e5bdc1a47b53

Contents?: true

Size: 1.48 KB

Versions: 9

Compression:

Stored size: 1.48 KB

Contents

module ContextualizationResultHelper
  def render_affable_expectation_result(affable_expectation_result)
    %Q{#{status_icon(affable_expectation_result[:result])} #{affable_expectation_result[:explanation]}}.html_safe
  end

  def render_feedback?(contextualization)
    contextualization.feedback.present?
  end

  def t_contextualization_status(contextualization)
    t contextualization_status(contextualization)
  end

  def contextualization_status(contextualization)
    if contextualization.exercise.hidden?
      :hidden_done
    elsif contextualization.exercise.choice?
      contextualization.solved? ? :correct_answer : :wrong_answer
    else
      contextualization_status_translation_key contextualization
    end
  end

  def contextualization_status_translation_key(contextualization)
    if contextualization.exercise.input_kindergarten?
      "kindergarten_#{contextualization.submission_status}"
    else
      contextualization.submission_status
    end
  end

  def render_test_result_header(test_result)
    [test_result[:title].presence, test_result[:summary]].compact.join(': ').html_safe
  end

  def render_test_results(contextualization)
    if contextualization.test_results.present?
      template = contextualization.result.present? ? 'layouts/mixed_results' : 'layouts/test_results'
      render partial: template, locals: { contextualization: contextualization }
    else
      render partial: 'layouts/result', locals: { contextualization: contextualization }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mumuki-laboratory-8.2.1 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-8.2.0 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-8.1.3 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-8.1.2 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-8.1.1 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-8.1.0 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-7.12.3 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-8.0.0 app/helpers/contextualization_result_helper.rb
mumuki-laboratory-7.12.1 app/helpers/contextualization_result_helper.rb