Class: ClassGroups::SemesterAttendancesController

Inherits:
EnrollmentsController
  • Object
show all
Defined in:
app/controllers/gaku/class_groups/semester_attendances_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/gaku/class_groups/semester_attendances_controller.rb', line 8

def index
  @students = @class_group.students
  @semesters = @class_group.semesters

  check_or_init_semester_attendance

  @semester_attendances = Gaku::SemesterAttendance.where(student_id: @students.pluck(:id), semester_id: @semesters.pluck(:id))
  @semester_attendance_results = @semester_attendances.grouped_for_table

  respond_with @semester_attendances
end

#updateObject



21
22
23
24
25
# File 'app/controllers/gaku/class_groups/semester_attendances_controller.rb', line 21

def update
  @semester_attendance = Gaku::SemesterAttendance.find(params[:id])
  @semester_attendance.update(semester_attendance_params)
  render nothing: true
end