Sha256: 99b47688a2a2381addaca2c96bd3375d5cd9992ddc1e87580cfedc6790c77051

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

module Sis
  module Core
    class ExamResult < ApplicationRecord
      PASS = 'Pass'.freeze
      FAIL = 'Fail'.freeze

      belongs_to :exam
      belongs_to :application

      validates :points, presence: true

      before_validation :set_status

      def set_status
        self.status = if exam && exam.pass_point >= points
                        PASS
                      else
                        FAIL
                      end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sis_core-1.0.5 app/models/sis/core/exam_result.rb