diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index c4bfeb3f..df14dd53 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2322,7 +2322,7 @@ end def update_subject_member_count if params[:subject] && params[:member_count] @subject = Subject.where(:id => params[:subject]).first - @subject.update_attributes(:student_count => params[:member_count]) if @subject.present? + @subject.update_attributes(:student_count => params[:member_count], :participant_count => params[:member_count].to_i * 0.35) if @subject.present? end end diff --git a/app/models/subject.rb b/app/models/subject.rb index f4eaaad8..170cff3d 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -10,7 +10,7 @@ class Subject < ActiveRecord::Base belongs_to :major # score_count 只能适合在首页使用 attr_accessible :description, :name, :status, :visits, :user_id, :course_list_id, :major_id, :learning_notes, :introduction, - :homepage_show, :score_count, :publish_time, :updated_at, :excellent, :student_count + :homepage_show, :score_count, :publish_time, :updated_at, :excellent, :student_count, :participant_count has_many :stages, :dependent => :destroy, :order => "stages.position ASC" has_many :stage_shixuns, :dependent => :destroy