for attendance function