|  |  | @ -488,17 +488,19 @@ class ShixunsController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  | 			tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") |  |  |  | 			tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") | 
			
		
	
		
		
			
				
					
					|  |  |  | 		end |  |  |  | 		end | 
			
		
	
		
		
			
				
					
					|  |  |  | 		current_myshixun = @shixun.current_myshixun(current_user.id) |  |  |  | 		current_myshixun = @shixun.current_myshixun(current_user.id) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		min_challenges = @shixun.challenges.pluck(:id , :st) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if current_myshixun |  |  |  | 		if current_myshixun | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			games = current_myshixun.games | 
			
		
	
		
		
			
				
					
					|  |  |  | 			# 如果TPM和TPI的管卡数不相等或者关卡顺序错了,说明实训被极大的改动,需要重置 |  |  |  | 			# 如果TPM和TPI的管卡数不相等或者关卡顺序错了,说明实训被极大的改动,需要重置 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if current_myshixun.games.count != @shixun.challenges_count || |  |  |  | 			if games.size != min_challenges.size || games.map(&:challenge_id) != min_challenges.map{|challenge| challenge.first} | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					current_myshixun.games.reorder(:challenge_id).pluck(:challenge_id) != @shixun.challenges.reorder(:id).pluck(:id) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 				uid_logger_error("7777777777777777#{current_myshixun.games.count}, #{@shixun.challenges_count}") |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				# 这里页面弹框要收到 当前用户myshixun的identifier. |  |  |  | 				# 这里页面弹框要收到 当前用户myshixun的identifier. | 
			
		
	
		
		
			
				
					
					|  |  |  | 				tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") |  |  |  | 				tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") | 
			
		
	
		
		
			
				
					
					|  |  |  | 			end |  |  |  | 			end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			# 如果存在实训,则直接进入实训 |  |  |  | 			# 如果存在实训,则直接进入实训 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			@current_task = current_myshixun.current_task |  |  |  | 			@current_task = current_myshixun.current_task(games) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		else |  |  |  | 		else | 
			
		
	
		
		
			
				
					
					|  |  |  | 			# 如果未创建关卡一定不能开启实训,否则TPI没法找到当前的关卡 |  |  |  | 			# 如果未创建关卡一定不能开启实训,否则TPI没法找到当前的关卡 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if @shixun.challenges_count == 0 |  |  |  | 			if @shixun.challenges_count == 0 | 
			
		
	
	
		
		
			
				
					|  |  | @ -506,10 +508,10 @@ class ShixunsController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  | 			end |  |  |  | 			end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			# 判断实训是否全为选择题 |  |  |  | 			# 判断实训是否全为选择题 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			is_choice_type = @shixun.is_choice_type? |  |  |  | 			is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			if !is_choice_type |  |  |  | 			if !is_choice_type | 
			
		
	
		
		
			
				
					
					|  |  |  | 				commit = GitService.commits(repo_path: @repo_path).try(:first) |  |  |  | 				commit = GitService.commits(repo_path: @repo_path).try(:first) | 
			
		
	
		
		
			
				
					
					|  |  |  | 				Rails.logger.info("First comit########{commit}") |  |  |  | 				uid_logger("First comit########{commit}") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? |  |  |  | 				tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? | 
			
		
	
		
		
			
				
					
					|  |  |  | 				commit_id = commit["id"] |  |  |  | 				commit_id = commit["id"] | 
			
		
	
		
		
			
				
					
					|  |  |  | 			end |  |  |  | 			end | 
			
		
	
	
		
		
			
				
					|  |  | @ -528,13 +530,13 @@ class ShixunsController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  | 						# fork仓库 |  |  |  | 						# fork仓库 | 
			
		
	
		
		
			
				
					
					|  |  |  | 						project_fork(myshixun, @repo_path, current_user.login) |  |  |  | 						project_fork(myshixun, @repo_path, current_user.login) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 						#rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path ) |  |  |  | 						rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path ) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						#uid_logger("start openGameInstance") |  |  |  | 						uid_logger("start openGameInstance") | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						#uri = "#{cloud_bridge}/bridge/game/openGameInstance" |  |  |  | 						uri = "#{cloud_bridge}/bridge/game/openGameInstance" | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						#logger.info("end openGameInstance") |  |  |  | 						logger.info("end openGameInstance") | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						#params = {tpiID: "#{myshixun.id}", tpmGitURL:rep_url, tpiRepoName: myshixun.repo_name.split("/").last} |  |  |  | 						params = {tpiID: "#{myshixun.id}", tpmGitURL:rep_url, tpiRepoName: myshixun.repo_name.split("/").last} | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						#uid_logger("openGameInstance params is #{params}") |  |  |  | 						uid_logger("openGameInstance params is #{params}") | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						# res = interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" |  |  |  | 						interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 					end |  |  |  | 					end | 
			
		
	
		
		
			
				
					
					|  |  |  | 					# 其它创建关卡等操作 |  |  |  | 					# 其它创建关卡等操作 | 
			
		
	
		
		
			
				
					
					|  |  |  | 					challenges = @shixun.challenges |  |  |  | 					challenges = @shixun.challenges | 
			
		
	
	
		
		
			
				
					|  |  | @ -565,6 +567,7 @@ class ShixunsController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  | 			end |  |  |  | 			end | 
			
		
	
		
		
			
				
					
					|  |  |  | 		end |  |  |  | 		end | 
			
		
	
		
		
			
				
					
					|  |  |  | 	end |  |  |  | 	end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	# gameID 及实训ID |  |  |  | 	# gameID 及实训ID | 
			
		
	
		
		
			
				
					
					|  |  |  | 	# status:  0 , 1 申请过, 2,实训关卡路径未填, 3 实训标签未填, 4 实训未创建关卡 |  |  |  | 	# status:  0 , 1 申请过, 2,实训关卡路径未填, 3 实训标签未填, 4 实训未创建关卡 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	def publish |  |  |  | 	def publish | 
			
		
	
	
		
		
			
				
					|  |  | 
 |