Sha256: 0865ba953d6d8a22a9e8a5dfb1caad78e4a32dde4a2da22228b064eb93493ec0

Contents?: true

Size: 1.37 KB

Versions: 23

Compression:

Stored size: 1.37 KB

Contents

# <%= autogenerated_model_warning %>

class Assignment < ApplicationRecord
  include CanvasSync::Record
  include CanvasSync::Concerns::ApiSyncable
  # include CanvasSync::Concerns::LiveEventSync

  canvas_sync_features :defaults

  validates :canvas_id, uniqueness: true, presence: true
  belongs_to :context, polymorphic: true, optional: true, primary_key: :canvas_id, foreign_key: :canvas_context_id, foreign_type: :canvas_context_type
  belongs_to :assignment_group, optional: true, primary_key: :canvas_id, foreign_key: :canvas_assignment_group_id
  has_many :submissions, primary_key: :canvas_id, foreign_key: :canvas_assignment_id

  has_many :context_module_items, as: :content, primary_key: :canvas_id, foreign_key: :canvas_content_id, foreign_type: :canvas_content_type, dependent: :destroy
  has_many :context_modules, through: :context_module_items

  api_syncable({
    title: :name,
    description: :description,
    due_at: :due_at,
    unlock_at: :unlock_at,
    lock_at: :lock_at,
    points_possible: :points_possible,
    grading_type: :grading_type,
    submission_types: lambda { |p| p["submission_types"].join(",") },
    canvas_context_id: :course_id,
    canvas_context_type: lambda { |_p| "Course" },
    canvas_assignment_group_id: :assignment_group_id,
    canvas_grading_standard_id: :grading_standard_id,
  }, -> (api) { api.assignment(canvas_context_id, canvas_id) })
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
canvas_sync-0.22.6 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.5 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.4 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.3 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.2 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.1 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta8 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta7 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta6 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta5 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta4 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta3 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta2 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.22.0.beta1 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.21.1 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.21.1.beta1 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.21.0 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.21.0.beta5 lib/canvas_sync/generators/templates/models/assignment.rb
canvas_sync-0.21.0.beta4 lib/canvas_sync/generators/templates/models/assignment.rb