diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index af0158cfd..f01ad4b6b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -442,12 +442,18 @@ class ApplicationController < ActionController::Base shixun.shixun_service_configs.each do |config| mirror = config.mirror_repository if mirror.name.present? + # 资源限制没有就传默认值。 + cpu_limit = config.cpu_limit.presence || 1 + cpu_request = config.lower_cpu_limit.presence || 0.1 + memory_limit = config.memory_limit.presence || 1024 + request_limit = config.resource_limit.presence || 10 + resource_limit = config.resource_limit.presence || 10000 container << {:image => mirror.name, - :cpuLimit => config.cpu_limit, - :cpuRequest => config.lower_cpu_limit, - :memoryLimit => "#{config.memory_limit}M", - :memoryRequest => "#{config.request_limit}M", - :resourceLimit => "#{config.resource_limit}K", + :cpuLimit => cpu_limit, + :cpuRequest => cpu_request, + :memoryLimit => "#{memory_limit}M", + :memoryRequest => "#{request_limit}M", + :resourceLimit => "#{resource_limit}K", :type => mirror.try(:main_type) == "1" ? "main" : "sub"} end end diff --git a/app/controllers/edu_settings_controller.rb b/app/controllers/edu_settings_controller.rb index 0d80cbf3d..6baf38e5b 100644 --- a/app/controllers/edu_settings_controller.rb +++ b/app/controllers/edu_settings_controller.rb @@ -1,5 +1,5 @@ class EduSettingsController < ApplicationController - # before_action :require_admin + before_action :require_admin before_action :set_edu_setting, only: [:show, :edit, :update, :destroy] # GET /edu_settings diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index f5003a0c7..5aecaadb0 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -896,13 +896,31 @@ class PollsController < ApplicationController def commit_poll ActiveRecord::Base.transaction do begin - poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first - poll_user_params = { - :commit_status => 1, - :end_at => Time.now - } - poll_user_current.update_attributes(poll_user_params) - normal_status(0, "问卷提交成功!") + @poll_multi_questions = @poll.poll_questions.where(question_type:2).select(:id,:max_choices,:min_choices,:question_number) + error_question = [] + @poll_multi_questions.each do |q| + poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size + if q.max_choices.present? && (poll_user_votes > q.max_choices) + error_messages = "第#{q.question_number}题:超过最大选项限制" + elsif q.min_choices.present? && (poll_user_votes < q.min_choices) + error_messages = "第#{q.question_number}题:不得少于最小选项限制" + else + error_messages = nil + end + error_question.push(error_messages) + end + error_question = error_question.reject(&:blank?) + if error_question.reject(&:blank?).length > 0 + normal_status(-1, "#{error_question.join("\n")}") + else + poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first + poll_user_params = { + :commit_status => 1, + :end_at => Time.now + } + poll_user_current.update_attributes(poll_user_params) + normal_status(0, "问卷提交成功!") + end ## 需添加发送消息的接口,稍后添加 rescue Exception => e uid_logger_error(e.message) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 8d9db7c3f..7c48d372b 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -297,6 +297,7 @@ class BoardsNew extends Component{ .courseForm .noBorder { border-bottom: none; } + `}
-              
{topicId==undefined?"新建":"编辑"}毕设选题
- this.props.history.goBack()} className="color-grey-6 fr font-16">返回 -
+              
{topicId==undefined?"新建":"编辑"}毕设选题
+ this.props.history.goBack()} className="color-grey-6 fr font-16">返回 +
-						 
-                            
+                            
                            
-             是否确认删除 ? 关闭后, 实训名称 简介 技术平台 
-                  列表中没有?
-                  申请新建
-                 新建申请已提交,请等待管理员的审核 请在配置页面完成后续的评测脚本设置操作 评测脚本 原有脚本将被新的脚本覆盖,无法撤销 是否确认执行覆盖操作 评测脚本生成成功! 
-											使用自定义模板,平台无法自动更新脚本, 实训名称 执行命令不能为空 程序最大执行时间 Pod存活时间 命令行 公开程度 发布信息 服务配置 {item.name} 简介 评测脚本 原有脚本将被新的脚本覆盖,无法撤销 是否确认执行覆盖操作 评测脚本生成成功! 
+												使用自定义模板,平台无法自动更新脚本, 执行命令不能为空 程序最大执行时间 Pod存活时间 命令行 公开程度 发布信息 
-          {
-            // this.props.identity<4&&this.props.status==0?
-            this.props.identity<5?
-               服务配置 {item.name} 
+						{
+							// this.props.identity<4&&this.props.status==0?
+							this.props.identity<5?
+								
用户不能再开始挑战了是否确认关闭 ?) -
-								
-											请在关卡创建完后手动更新脚本中的必填参
-											数和以下2个数组元素:
-											challengeProgramNames
-											sourceClassNames
-											示例:有2个关卡的实训
-											各关卡的待编译文件为:
-											src/step1/HelloWorld.java
-											src/step2/Other.java
-											各关卡的编译后生成的执行文件为:
-											step1.HelloWorld
-											step2.Other
-											则数组元素更新如下:
-											challengeProgramNames=("src/step1/
-											HelloWorld.java" "src/step2/Other.java")
-											sourceClassNames=("step1.HelloWorld
-											" "step2.Other")
-											其它参数可按实际需求定制
-										) +
+									
+												请在关卡创建完后手动更新脚本中的必填参
+												数和以下2个数组元素:
+												challengeProgramNames
+												sourceClassNames
+												示例:有2个关卡的实训
+												各关卡的待编译文件为:
+												src/step1/HelloWorld.java
+												src/step2/Other.java
+												各关卡的编译后生成的执行文件为:
+												step1.HelloWorld
+												step2.Other
+												则数组元素更新如下:
+												challengeProgramNames=("src/step1/
+												HelloWorld.java" "src/step2/Other.java")
+												sourceClassNames=("step1.HelloWorld
+												" "step2.Other")
+												其它参数可按实际需求定制
+