attendance_record sorting fix