Commit ae1ca5ad authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou
Browse files

add link to warning

parent ca1cd476
Pipeline #30687 passed with stage
in 35 minutes and 58 seconds
......@@ -177,12 +177,13 @@ class Volunteer < ApplicationRecord
.active_semester_mission(semester)
end
def unsubmitted_semester_feedbacks
semester_process_volunteers.where(commited_at: nil)
end
def unsubmitted_semester_feedbacks?
false if semester_process_volunteers.blank?
semester_process_volunteers.each do |spv|
return true unless spv.commited_at?
end
false
return false if unsubmitted_semester_feedbacks.blank?
true
end
## Activness Scopes
......
- if current_user.volunteer? && current_user.volunteer.unsubmitted_semester_feedbacks?
- message = 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
= notification_warning_bubble(message)
- current_user.volunteer.unsubmitted_semester_feedbacks.each do |spv|
- message = 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
- message << "<a href='#{review_semester_semester_process_volunteer_path(spv)}'>Bitte klicken Sie hier um diesen zu bestätigen.</a>".html_safe
= notification_warning_bubble(message)
......@@ -2,7 +2,6 @@ require 'application_system_test_case'
class SemesterFeedbackTest < ApplicationSystemTestCase
setup do
@superadmin = create :user
@volunteer = create :volunteer_with_user
@assignment = create :assignment, volunteer: @volunteer
@group_assignment = create :group_assignment, volunteer: @volunteer
......@@ -10,21 +9,25 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
@subject_volunteer = create(:semester_process_volunteer, :with_mission, volunteer: @volunteer,
semester_process: @subject)
@mission = @subject_volunteer.semester_process_volunteer_missions.first.assignment
login_as @superadmin
login_as @volunteer.user
visit review_semester_semester_process_volunteer_path(@subject_volunteer)
end
test 'volunteer with unsubmitted feedback should see a warning' do
second_spv = create(:semester_process_volunteer, :with_mission, volunteer: @volunteer,
semester_process: @subject)
login_as @volunteer.user
visit volunteer_path(@volunteer)
assert page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen', count: 2
visit root_path
assert page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen', count: 2
click_link 'Bitte klicken Sie hier um diesen zu bestätigen', match: :first
submit_feedback(@subject_volunteer)
visit root_path
assert page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen', count: 1
click_link 'Bitte klicken Sie hier um diesen zu bestätigen'
submit_feedback(second_spv)
visit root_path
assert_not page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment