You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
397 B
23 lines
397 B
class SalesmanCustomer < ApplicationRecord
|
|
belongs_to :salesman, :touch => true, counter_cache: true
|
|
belongs_to :school
|
|
belongs_to :user
|
|
|
|
def name
|
|
user.real_name
|
|
end
|
|
|
|
def school_name
|
|
school.name
|
|
end
|
|
|
|
def courses_count
|
|
CourseMember.where(user_id: id).teachers_and_admin.count
|
|
end
|
|
|
|
def shixuns_count
|
|
ShixunMember.where(user_id: id, role: [1, 2]).count
|
|
end
|
|
|
|
end
|