|  |  |  | @ -3,7 +3,7 @@ class ChangeExercise1930Position < ActiveRecord::Migration[5.2] | 
			
		
	
		
			
				
					|  |  |  |  |     exs = Exercise.all.includes(:exercise_questions) | 
			
		
	
		
			
				
					|  |  |  |  |     exs.each do |ex| | 
			
		
	
		
			
				
					|  |  |  |  |       ex_questions = ex&.exercise_questions&.select(:id,:question_number,:exercise_id)&.order("question_number ASC")  #试卷的位置迁移 | 
			
		
	
		
			
				
					|  |  |  |  |       if ex_questions.exists? | 
			
		
	
		
			
				
					|  |  |  |  |       if ex_questions.present? | 
			
		
	
		
			
				
					|  |  |  |  |         ex_questions.each_with_index do |q,index| | 
			
		
	
		
			
				
					|  |  |  |  |           puts index | 
			
		
	
		
			
				
					|  |  |  |  |           q_num = index + 1 | 
			
		
	
	
		
			
				
					|  |  |  | @ -14,7 +14,7 @@ class ChangeExercise1930Position < ActiveRecord::Migration[5.2] | 
			
		
	
		
			
				
					|  |  |  |  |       end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |       ex_q_bank = ex&.exercise_bank&.exercise_bank_questions&.select(:id,:question_number,:exercise_bank_id,:shixun_id)&.order("question_number ASC") #试卷的习题库位置迁移 | 
			
		
	
		
			
				
					|  |  |  |  |       if ex_q_bank.exists? | 
			
		
	
		
			
				
					|  |  |  |  |       if ex_q_bank.present? | 
			
		
	
		
			
				
					|  |  |  |  |         ex_q_bank.each_with_index do |q,index| | 
			
		
	
		
			
				
					|  |  |  |  |           puts index | 
			
		
	
		
			
				
					|  |  |  |  |           q_num_1 = index + 1 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |