diff --git a/app/assets/javascripts/edu_datas.js b/app/assets/javascripts/edu_datas.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/edu_datas.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/edu_datas.scss b/app/assets/stylesheets/edu_datas.scss new file mode 100644 index 000000000..761de8ec4 --- /dev/null +++ b/app/assets/stylesheets/edu_datas.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the edu_datas controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 317383d5a..dd015ba9e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -285,7 +285,7 @@ class ApplicationController < ActionController::Base def user_setup # # reacct静态资源加载不需要走这一步 - return if params[:controller] == "main" + #return if params[:controller] == "main" # Find the current user #Rails.logger.info("current_laboratory is #{current_laboratory} domain is #{request.subdomain}") User.current = find_current_user diff --git a/app/controllers/edu_datas_controller.rb b/app/controllers/edu_datas_controller.rb new file mode 100644 index 000000000..bb6f7776e --- /dev/null +++ b/app/controllers/edu_datas_controller.rb @@ -0,0 +1,29 @@ +class EduDatasController < ApplicationController + before_action :find_game + skip_before_action :user_setup + skip_before_action :setup_laboratory + # layout :false + include GitHelper + + # params[:game_id] + def game + @shixun = @challenge.shixun + @shixun_env = @shixun.mirror_name + @shixun_tags = @challenge.challenge_tags.map(&:name) + end + + def code_lines + path = @challenge.path + myshixun = @game.myshixun + # content = git_fle_content(myshixun.repo_path, path) || "" + @content = {"content":"#coding=utf-8\n\n#请在此处添加代码完成输出“Hello Python”,注意要区分大小写!\n###### Begin ######\n\n\n\n###### End ######\n\n"} + @content[:content].include?("Begin") + end + + private + def find_game + game_id = params[:game_id] + @game = Game.find(game_id) + @challenge = @game.challenge + end +end diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index e8554300c..75a6012b0 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -1,5 +1,7 @@ class MainController < ApplicationController skip_before_action :check_sign + skip_before_action :user_setup + skip_before_action :setup_laboratory def first_stamp render :json => { status: 0, message: Time.now.to_i } diff --git a/app/helpers/edu_datas_helper.rb b/app/helpers/edu_datas_helper.rb new file mode 100644 index 000000000..1a8584d15 --- /dev/null +++ b/app/helpers/edu_datas_helper.rb @@ -0,0 +1,2 @@ +module EduDatasHelper +end diff --git a/app/views/edu_datas/code_lines.json.jbuilder b/app/views/edu_datas/code_lines.json.jbuilder new file mode 100644 index 000000000..d4cccf0a7 --- /dev/null +++ b/app/views/edu_datas/code_lines.json.jbuilder @@ -0,0 +1 @@ +json.content @content \ No newline at end of file diff --git a/app/views/edu_datas/game.json.jbuilder b/app/views/edu_datas/game.json.jbuilder new file mode 100644 index 000000000..3f4a0335e --- /dev/null +++ b/app/views/edu_datas/game.json.jbuilder @@ -0,0 +1,6 @@ +json.challenge @challenge +json.game @game + +json.shixun @shixun +json.shixun_env @env +json.shixun_tags @shixun_tags \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f13fd714b..a65a7f4c1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1044,6 +1044,13 @@ Rails.application.routes.draw do get :student_hot_evaluations end end + + resources :edu_datas do + collection do + get :game + get :code_lines + end + end end namespace :admins do diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 5fd2abdee..030e2cde7 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -157,9 +157,9 @@ class Trainingjobsetting extends Component { this.props.triggerRef(this); - // if (this.props.isAdmin() === false) { - // this.cancelEdit() - // } + if (this.props.isAdmin() === false) { + this.cancelEdit() + } } // componentWillReceiveProps(nextProps) { @@ -302,7 +302,7 @@ class Trainingjobsetting extends Component { work_efficiencys: result.data.work_efficiency, latedeductiontwo: result.data.eff_score, proportion: result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? "自定义分值" : "", - publicwork: result.data.work_public, + publicwork: result.data.score_open, challenge_settings: result.data.challenge_settings, code_review: result.data.code_review, total_scoretwo:result.data.total_score, @@ -676,6 +676,7 @@ class Trainingjobsetting extends Component { // this.props.showNotification(`总分值+效率效率分之和要等于100,现在分值为` + max); // return; // } + if (this.state.proportion === "自定义分值") { try { if(parseFloat(this.state.CalculateMax)!==parseFloat(max)){ @@ -722,8 +723,8 @@ class Trainingjobsetting extends Component { late_penalty: parseInt(this.state.latededuction), //迟交扣分 late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 - work_efficiency: this.state.completionefficiencyscore, //完成效率评分占比 - eff_score: this.state.completionefficiencyscore === true ? this.state.latedeductiontwo : undefined,//效率分 + work_efficiency: this.state.work_efficiencys, //完成效率评分占比 + eff_score: this.state.work_efficiencys === true ? this.state.latedeductiontwo : undefined,//效率分 shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, challenge_settings: array, score_open: this.state.publicwork, @@ -756,7 +757,7 @@ class Trainingjobsetting extends Component { late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 work_efficiency: this.state.work_efficiencys, //完成效率评分占比 - eff_score: this.state.completionefficiencyscore === true ? this.state.latedeductiontwo : undefined,//效率分 + eff_score: this.state.work_efficiencys=== true ? this.state.latedeductiontwo : undefined,//效率分 shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, challenge_settings: array, score_open: this.state.publicwork, diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 0e4ea3073..6e27f9591 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1039,17 +1039,17 @@ submittojoinclass=(value)=>{ ` } -