Class: Gaku::ExamPortionScoresController

Inherits:
GakuController
  • Object
show all
Defined in:
app/controllers/gaku/exam_portion_scores_controller.rb

Instance Method Summary collapse

Methods inherited from GakuController

#resolve_layout

Instance Method Details

#updateObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/gaku/exam_portion_scores_controller.rb', line 9

def update
  exam_portion_score = ExamPortionScore.find(params[:id])
  exam_portion_score.update_attributes(exam_portion_score_params)

  student         = exam_portion_score.student
  grading_methods = @gradable_scope.grading_methods

  calculations = Grading::Single::Calculations.new(grading_methods, student, @exam, @gradable_scope, @gradable_scope.students).calculate
  message = {
              exam_id: @exam.id,
              gradable_type: gradable_type,
              gradable_id: @gradable_scope.id,
              calculations: calculations,
              exam_portion_score: exam_portion_score,
              exam_portion_score_type: exam_portion_score.exam_portion.score_type
            }

  $redis.publish('grading-change', message.to_json)

  render nothing: true
end