Sha256: 60c32d03d942609c4150f756df0dd21845f579ea9039afedb1b2bb2ca8e06d05

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 Bytes

Contents

<%= autogenerated_model_warning %>

class Submission < ApplicationRecord
  include CanvasSync::ApiSyncable

  validates :canvas_submission_id, uniqueness: true, presence: true
  belongs_to :assignment, primary_key: :canvas_assignment_id, foreign_key: :canvas_assignment_id, optional: true
  belongs_to :user, primary_key: :canvas_user_id, foreign_key: :canvas_user_id, optional: true
  belongs_to :course, primary_key: :canvas_course_id, foreign_key: :canvas_course_id, optional: true

  api_syncable({
    canvas_assignment_id: :assignment_id,
    canvas_user_id: :user_id,
    submitted_at: :submitted_at,
    graded_at: :graded_at,
    score: :score,
    excused: :excused,
    workflow_state: :workflow_state,
  }, -> (api) { api.user_course_assignment_submission(assignment.context.canvas_course_id, canvas_assignment_id, canvas_user_id) })
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
canvas_sync-0.9.4 lib/canvas_sync/generators/templates/models/submission.rb
canvas_sync-0.9.3 lib/canvas_sync/generators/templates/models/submission.rb
canvas_sync-0.9.2 lib/canvas_sync/generators/templates/models/submission.rb