Module: Course::Assessment::AssessmentsHelper

Includes:
Course::Achievement::AchievementsHelper, Condition::ConditionsHelper
Defined in:
app/helpers/course/assessment/assessments_helper.rb

Instance Method Summary collapse

Methods included from Condition::ConditionsHelper

#component_enabled?

Methods included from Course::Achievement::AchievementsHelper

#achievement_badge_path, #display_achievement_badge

Instance Method Details

#condition_not_satisfied(assessment) ⇒ Object


16
17
18
19
20
# File 'app/helpers/course/assessment/assessments_helper.rb', line 16

def condition_not_satisfied(assessment)
  cannot?(:attempt, assessment) &&
    assessment.start_at < Time.zone.now &&
    !assessment.conditions_satisfied_by?(current_course_user)
end

#display_assessment_tabsObject


6
7
8
9
10
11
12
13
14
# File 'app/helpers/course/assessment/assessments_helper.rb', line 6

def display_assessment_tabs
  return nil if @category.tabs.count == 1
  tabs do
    @category.tabs.each do |item|
      concat(nav_to(format_inline_text(item.title),
                    course_assessments_path(current_course, category: @category, tab: item)))
    end
  end
end

#show_bonus_attributes?Boolean

Returns:

  • (Boolean)

22
23
24
25
26
27
28
29
# File 'app/helpers/course/assessment/assessments_helper.rb', line 22

def show_bonus_attributes?
  @show_bonus_end_at ||= begin
    return false unless current_course.gamified?
    @assessments.any? do |assessment|
      assessment.bonus_end_at.present? && assessment.time_bonus_exp > 0
    end
  end
end

#show_end_at?Boolean

Returns:

  • (Boolean)

31
32
33
34
35
# File 'app/helpers/course/assessment/assessments_helper.rb', line 31

def show_end_at?
  @show_end_at ||= begin
    @assessments.any? { |assessment| assessment.end_at.present? }
  end
end