From d16cbd6d18e7f758968dc6f0a23c24c975fc797b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 21 Sep 2019 19:33:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- app/models/subject.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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