|  |  |  | @ -500,6 +500,15 @@ class Course < ActiveRecord::Base | 
			
		
	
		
			
				
					|  |  |  |  |     end | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   # 课堂实训作业的评测次数 | 
			
		
	
		
			
				
					|  |  |  |  |   def evaluate_count | 
			
		
	
		
			
				
					|  |  |  |  |     course_user_ids = self.members.map(&:user_id) | 
			
		
	
		
			
				
					|  |  |  |  |     shixun_ids = self.homework_commons.joins(:homework_commons_shixuns).where(homework_type: 4).pluck(:shixun_id) | 
			
		
	
		
			
				
					|  |  |  |  |     return 0 if shixun_ids.blank? | 
			
		
	
		
			
				
					|  |  |  |  |     Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count) | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   #课程动态公共表记录 | 
			
		
	
		
			
				
					|  |  |  |  |   def act_as_course_activity | 
			
		
	
		
			
				
					|  |  |  |  |     self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id) | 
			
		
	
	
		
			
				
					|  |  |  | 
 |