#
# Copyright (C) 2014 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#

class SisPostGradesStatus < ActiveRecord::Base
  belongs_to :course
  belongs_to :course_section
  belongs_to :user
end

#
# Copyright (C) 2014 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#

class SisPostGradesStatus < ActiveRecord::Base
  ALLOWED_STATUSES = %w{success warning failed}
  belongs_to :course
  belongs_to :course_section
  belongs_to :user

  validates :course, presence: true
  validates :grades_posted_at, presence: true
  validates :message, presence: true
  validates :status, presence: true, inclusion: {in: ALLOWED_STATUSES}
end

Add validation to the post grades model
Add validation to the post grades model

Fixes: SIS-748

Test-Plan:
See SIS-631

Change-Id: I9e0d74b25dced0a20592ba69b0f922a5a82d77c2
Reviewed-on: https://gerrit.instructure.com/46622
Tested-by: Jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@instructure.com>
Product-Review: Tyler Pickett <a460d6dd1fd0dd28a96a2ec27768abb6395dd22b@instructure.com>
Reviewed-by: Tyler Pickett <a460d6dd1fd0dd28a96a2ec27768abb6395dd22b@instructure.com>
QA-Review: Jeremy Putnam <b030d6d6f199f844ec424882be473c2ab9adc93b@instructure.com>
