Merge branch 'develop' into dev_jupyter

dev_jupyter
daiao 5 years ago
commit 65e0485519

@ -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.

@ -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/

@ -41,8 +41,8 @@ module GitHelper
# 更新文件代码 # 更新文件代码
# content 文件内容message提交描述 # content 文件内容message提交描述
def update_file_content(content, repo_path, path, mail, username, message) def update_file_content(content, repo_path, path, mail, username, message)
content = Base64.encode64(content) #content = Base64.encode64(content)
GitService.update_file_base64(repo_path: repo_path, file_path: path, message: message, GitService.update_file(repo_path: repo_path, file_path: path, message: message,
content: content, author_name: username, author_email: mail) content: content, author_name: username, author_email: mail)
end end

@ -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

@ -0,0 +1,2 @@
module EduDatasHelper
end

@ -0,0 +1,6 @@
json.challenge @challenge
json.game @game
json.shixun @shixun
json.shixun_env @env
json.shixun_tags @shixun_tags

@ -1044,6 +1044,13 @@ Rails.application.routes.draw do
get :student_hot_evaluations get :student_hot_evaluations
end end
end end
resources :edu_datas do
collection do
get :game
get :code_lines
end
end
end end
namespace :admins do namespace :admins do

@ -157,9 +157,9 @@ class Trainingjobsetting extends Component {
this.props.triggerRef(this); this.props.triggerRef(this);
// if (this.props.isAdmin() === false) { if (this.props.isAdmin() === false) {
// this.cancelEdit() this.cancelEdit()
// } }
} }
// componentWillReceiveProps(nextProps) { // componentWillReceiveProps(nextProps) {
@ -302,7 +302,7 @@ class Trainingjobsetting extends Component {
work_efficiencys: result.data.work_efficiency, work_efficiencys: result.data.work_efficiency,
latedeductiontwo: result.data.eff_score, latedeductiontwo: result.data.eff_score,
proportion: result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? "自定义分值" : "", 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, challenge_settings: result.data.challenge_settings,
code_review: result.data.code_review, code_review: result.data.code_review,
total_scoretwo:result.data.total_score, total_scoretwo:result.data.total_score,
@ -676,6 +676,7 @@ class Trainingjobsetting extends Component {
// this.props.showNotification(`总分值+效率效率分之和要等于100现在分值为` + max); // this.props.showNotification(`总分值+效率效率分之和要等于100现在分值为` + max);
// return; // return;
// } // }
if (this.state.proportion === "自定义分值") { if (this.state.proportion === "自定义分值") {
try { try {
if(parseFloat(this.state.CalculateMax)!==parseFloat(max)){ if(parseFloat(this.state.CalculateMax)!==parseFloat(max)){
@ -722,8 +723,8 @@ class Trainingjobsetting extends Component {
late_penalty: parseInt(this.state.latededuction), //迟交扣分 late_penalty: parseInt(this.state.latededuction), //迟交扣分
late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间 late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间
answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项
work_efficiency: this.state.completionefficiencyscore, //完成效率评分占比 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, shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array, challenge_settings: array,
score_open: this.state.publicwork, 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'), //结束时间 late_time: moment(this.state.late_time).format('YYYY-MM-DD HH:mm'), //结束时间
answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项 answer_open_evaluation: this.state.level === "满分" ? true : false, //扣分项
work_efficiency: this.state.work_efficiencys, //完成效率评分占比 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, shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array, challenge_settings: array,
score_open: this.state.publicwork, score_open: this.state.publicwork,

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe EduDatasController, type: :controller do
end

@ -0,0 +1,15 @@
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the EduDatasHelper. For example:
#
# describe EduDatasHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe EduDatasHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save