Sha256: 68d93a2861eadec4e9f038d13f814daccee10a9bb7fbb140588988c7877e55fb

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

# #
# AUTO GENERATED MODEL
# This model was auto generated by the CanvasSync Gem.
# You can customize it as needed, but make sure you test
# any changes you make to the auto generated methods.
#


# CourseProgress is not a Canvas model. It is a table built from the Custom Report
class CourseProgress < ApplicationRecord
  include CanvasSync::Record
  include CanvasSync::Concerns::ApiSyncable

  canvas_sync_features :defaults

  belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true
  belongs_to :course, primary_key: :canvas_id, foreign_key: :canvas_course_id, optional: true

  validates_presence_of :canvas_user_id, :canvas_course_id
  validates_uniqueness_of :canvas_user_id, scope: :canvas_course_id

  api_syncable({
    requirement_count: :requirement_count,
    requirement_completed_count: :requirement_completed_count,
    # provisioning report has completion_date instead of completed_at in the API
    completion_date: :completed_at
  }, -> (api) { api.course_progress(canvas_course_id, canvas_user_id) })
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
canvas_sync-0.22.9 spec/dummy/app/models/course_progress.rb
canvas_sync-0.22.8 spec/dummy/app/models/course_progress.rb
canvas_sync-0.22.6 spec/dummy/app/models/course_progress.rb