Sha256: bf588e959a618a3e7a166b3fb2d0a2af362aae08632b309c1a3f4d901a0f422f

Contents?: true

Size: 1.36 KB

Versions: 85

Compression:

Stored size: 1.36 KB

Contents

module EducodeSales
  class Activity < ApplicationRecord
    belongs_to :staff
    has_many :activity_teachers, dependent: :destroy
    has_many :teachers, through: :activity_teachers, dependent: :restrict_with_exception
    has_many :manages, -> {where("educode_sales_activity_staffs.clazz_id = 0")}, dependent: :destroy, class_name: 'ActivityStaff'
    has_many :assists, -> {where("educode_sales_activity_staffs.clazz_id = 1")}, dependent: :destroy, class_name: 'ActivityStaff'
    has_many :experts , -> {where("educode_sales_activity_staffs.clazz_id = 2")}, dependent: :destroy, class_name: 'ActivityStaff'
    has_many :invitations , -> {where("educode_sales_activity_staffs.clazz_id = 3")}, dependent: :destroy, class_name: 'ActivityStaff'
    
    has_many :activity_staffs, dependent: :destroy
    has_many :activity_follow_ups, dependent: :destroy

    has_many :attachments, as: :container, dependent: :destroy

    belongs_to :last_follow_up, class_name: 'ActivityFollowUp', optional: true 

    belongs_to :sales, class_name: 'Staff', optional: true

    has_one :attachment, as: :container, dependent: :destroy

    enum clazz_id: ['全国会议', '区域会议', '单校会议', '国赛', '省赛', '夏令营']
    enum state_id: {
      '策划中': 1,
      '筹备中': 2,
      '实施中': 3,
      '已结束': 4,
      '已撤销': 5,
      '已推迟': 6
    }
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
educode_sales-0.9.72 app/models/educode_sales/activity.rb
educode_sales-0.9.71 app/models/educode_sales/activity.rb
educode_sales-0.9.70 app/models/educode_sales/activity.rb
educode_sales-0.9.69 app/models/educode_sales/activity.rb
educode_sales-0.9.68 app/models/educode_sales/activity.rb