Sha256: 51c8f1894269fedfaf26ae1e80edae1644393f289a2d05bc7266ab98342b9c0e

Contents?: true

Size: 957 Bytes

Versions: 6

Compression:

Stored size: 957 Bytes

Contents

module Gaku
  class Courses::ExamsController < GakuController

    respond_to :html
    respond_to :js, only: :index

    def index
      @course = Course.find(params[:course_id])
      respond_with @course
    end

    def grading
      @course = Course.find(params[:course_id])
      @exam = Exam.includes(exam_portions: :exam_portion_scores).find(params[:id])
      @students = @course.students
      @grading_methods = @course.grading_methods
      @gradable_scope = @course
      init_portion_scores

      @grading_calculations = Grading::Collection::Calculations.new(@grading_methods, @students, @exam, @gradable_scope).calculate

      render 'gaku/shared/grading/grading'
    end

    private

    def init_portion_scores
      @students.each do |student|
        @exam.exam_portions.each do |portion|
          portion.exam_portion_scores.where(student: student, gradable: @gradable_scope).first_or_create
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gaku_frontend-0.3.0 app/controllers/gaku/courses/exams_controller.rb
gaku_frontend-0.3.0.pre.4 app/controllers/gaku/courses/exams_controller.rb
gaku_frontend-0.3.0.pre.3 app/controllers/gaku/courses/exams_controller.rb
gaku_frontend-0.3.0.pre.2 app/controllers/gaku/courses/exams_controller.rb
gaku_frontend-0.3.0.pre.1 app/controllers/gaku/courses/exams_controller.rb
gaku_frontend-0.3.0.pre.0 app/controllers/gaku/courses/exams_controller.rb