app/models/event_group.rb
# for attendance CSV
#TODO: this logic is duplicated somewhat in
# Rollcall.attendance_table. The semantics are
# different, but the underlying calculation
# should be de-duped
for attendance CSV
TODO: this logic is duplicated somewhat in
Rollcall.attendance_table. The semantics are
different, but the underlying calculation
should be de-duped
for attendance CSV TODO : this logic is duplicated somewhat in Rollcall . attendance_table . The semantics are different but the underlying calculation should be de - duped
def attendance_rows
    students = self.roster | self.rollcalls.map(&:student_ids).inject([], :|)
               .map { |i| Student.find(i) }
    students = students.sort_by(&:sorting_name)
    students.map do |student|
      record = self.rollcalls.map do |rollcall|
        AttendanceHelper::STATES[rollcall.attendance_hash[student.id] || 1]
      end
      total = record.count do |status|
        AttendanceHelper::PRESENT_ISH.include?(status)
      end
      [student.name, student.id, total] + record
    end
  end
def attendance_rows students = self . roster | self . rollcalls . map ( & :student_ids ) . inject ( [ ] , :| ) . map { | i | Student . find ( i ) } students = students . sort_by ( & :sorting_name ) students . map do | student | record = self . rollcalls . map do | rollcall | AttendanceHelper :: STATES [ rollcall . attendance_hash [ student . id ] || 1 ] end total = record . count do | status | AttendanceHelper :: PRESENT_ISH . include? ( status ) end [ student . name , student . id , total ] + record end end
for attendance CSV
TODO: this logic is duplicated somewhat in
Rollcall.attendance_table.
for attendance CSV TODO : this logic is duplicated somewhat in Rollcall . attendance_table .