You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
807 B
20 lines
807 B
module Weapps::AttendancesHelper
|
|
|
|
def student_attendance_status attendance, user
|
|
st_attendance = attendance.course_member_attendances.find_by(user_id: user.id)
|
|
st_attendance.present? ? st_attendance.attendance_status : "ABSENCE"
|
|
end
|
|
|
|
def group_attendance_count attendances, member_ids
|
|
# course_member_ids = group.course_members.pluck(:id)
|
|
attendances.select{|attendance| member_ids.include?(attendance.course_member_id) && attendance.attendance_status == "NORMAL"}.size
|
|
end
|
|
|
|
def history_member_count member_attendances, status, attendance_id
|
|
member_attendances.select{|member_attendance| member_attendance.attendance_status == status && member_attendance.course_attendance_id == attendance_id}.size
|
|
end
|
|
|
|
def cal_rate base, sum
|
|
sum == 0 ? 0 : (base.to_f / sum)
|
|
end
|
|
end |