Commit 7b2c1aa8 authored by Tugce Nur Tas's avatar Tugce Nur Tas

show semester feedback status on billing expenses

parent 89c32874
......@@ -180,16 +180,32 @@ class Volunteer < ApplicationRecord
def self.feedback_overdue(semester)
joins(:contact).where(id: have_semester_process(semester).where("semester_process_volunteers.commited_at IS NULL").ids)
end
def unsubmitted_semester_feedbacks
semester_process_volunteers.where(commited_at: nil)
end
def submitted_semester_feedbacks
semester_process_volunteers.where.not(commited_at: nil)
end
def unsubmitted_semester_feedbacks?
return false if unsubmitted_semester_feedbacks.blank?
true
end
def submitted_semester_feedbacks_covers_semester?(selected_billing_semester)
submitted_semester_feedbacks.any? do |semester_feedback|
semester_feedback.semester.cover?(selected_billing_semester.to_date)
end
end
def unsubmitted_semester_feedbacks_covers_semester?(selected_billing_semester)
unsubmitted_semester_feedbacks.any? do |semester_feedback|
semester_feedback.semester.cover?(selected_billing_semester.to_date)
end
end
## Activness Scopes
#
scope :will_take_more_assignments, (-> { where(take_more_assignments: true) })
......@@ -372,7 +388,7 @@ class Volunteer < ApplicationRecord
def assignment_logs_started?
assignment_logs.started.any?
end
end
def group_assignment_started?
group_assignments.started.any?
......
......@@ -28,8 +28,11 @@ h1 Spesenformulare erfassen
td= check_box_tag 'selected_volunteers[]', volunteer.id,
@selected_volunteers.include?(volunteer.id.to_s), disabled: !volunteer.iban?
td
- if volunteer.unsubmitted_semester_feedbacks?
span.label.label-danger Unbestätigt
- if volunteer.submitted_semester_feedbacks_covers_semester?(@selected_billing_semester)
span.label.label-success Bestätigt
- elsif volunteer.unsubmitted_semester_feedbacks_covers_semester?(@selected_billing_semester)
span.label.label-warning Unbestätigt
- else
td= link_to volunteer, edit_volunteer_path(volunteer)
td
- if volunteer.iban?
......
Markdown is supported
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