diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb
index 57116a9e5..27e3fa2f4 100644
--- a/app/controllers/exercise_questions_controller.rb
+++ b/app/controllers/exercise_questions_controller.rb
@@ -497,7 +497,38 @@ class ExerciseQuestionsController < ApplicationController
ex_obj_score = @exercise_current_user.objective_score #全部客观题得分
ex_subj_score = @exercise_current_user.subjective_score < 0.0 ? 0.0 : @exercise_current_user.subjective_score #全部主观题得分
ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分
- if @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分,
+ if @exercise_question.question_type == Exercise::MULTIPLE
+ if ex_answers.present? #学生有回答时 取学生的答题得分,否则0分
+ answer_choice_array = []
+ ex_answers.each do |a|
+ answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
+ end
+ user_answer_content = answer_choice_array.sort
+ standard_answer = @exercise_question.exercise_standard_answers.pluck(:exercise_choice_id).sort
+ if standard_answer.size == 1 # 老数据需要判断学生答题是否正确, 正确取原题得分,否则是0分
+ standard_answer = standard_answer.first.to_s.split("").map(&:to_i).sort
+ if user_answer_content == standard_answer
+ ex_answer_old = @exercise_question.question_score
+ else
+ ex_answer_old = 0
+ end
+ else # 新多选题只需取第一条答题记录的得分
+ ex_answer_old = ex_answers.first.score > 0 ? ex_answers.first.score : 0
+ end
+ else
+ ex_answer_old = 0
+ end
+
+ new_obj_score = ex_obj_score - ex_answer_old + @c_score
+ total_scores = new_obj_score + ex_subj_score
+ ex_scores = {
+ :objective_score => new_obj_score,
+ :score => total_scores
+ }
+ @exercise_current_user.update_attributes(ex_scores)
+ ex_answers.update_all(:score => @c_score) #所有的正确选项需重新更新
+
+ elsif @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分,
ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和
each_right_score = (@c_score / ex_answers.count.to_f) #调分后,平均每关的分数
new_obj_score = ex_obj_score - ex_answer_old + @c_score
@@ -579,7 +610,7 @@ class ExerciseQuestionsController < ApplicationController
end
rescue Exception => e
uid_logger_error(e.message)
- tip_exception("没有权限")
+ tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
@@ -703,8 +734,8 @@ class ExerciseQuestionsController < ApplicationController
normal_status(-1,"用户不存在!")
elsif @c_score.blank?
normal_status(-1,"分数不能为空!")
- elsif @exercise_question.question_type <= Exercise::JUDGMENT
- normal_status(-1,"选择题/判断题不能调分!")
+ elsif @exercise_question.question_type == Exercise::SINGLE || @exercise_question.question_type == Exercise::JUDGMENT
+ normal_status(-1,"单选题/判断题不能调分!")
elsif params[:comment].present? && params[:comment].length > 100
normal_status(-1,"评语不能超过100个字符!")
else
diff --git a/app/views/shixuns/shixun_list.json.jbuilder b/app/views/shixuns/shixun_list.json.jbuilder
index 54ac65a0a..2f1d4905c 100644
--- a/app/views/shixuns/shixun_list.json.jbuilder
+++ b/app/views/shixuns/shixun_list.json.jbuilder
@@ -10,7 +10,7 @@ json.shixun_list do
# json.description highlights.values[0,5].each { |arr| arr.is_a?(Array) ? arr.join('...') : arr }.join('
')
json.content highlights
json.level level_to_s(obj.trainee)
- json.subjects obj.subjects do |subject|
+ json.subjects obj.subjects.uniq do |subject|
json.(subject, :id, :name)
end
end
diff --git a/dump.rdb b/dump.rdb
index bcf064366..9f62f75c7 100644
Binary files a/dump.rdb and b/dump.rdb differ
diff --git a/public/react/src/App.js b/public/react/src/App.js
index 1a4aedc05..17ee34255 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -326,6 +326,20 @@ class App extends Component {
});
wx.ready(function () {
console.log('wx is ready')
+ // var shareData = {
+ // title: 'EduCoder - 首页',
+ // desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。',
+ // link: currentUrl,
+ // imgUrl: window.__testImageUrl
+ // || (currentUrl.endsWith('/') ? currentUrl : currentUrl + '/') + 'react/build/images/share_logo_icon.jpg'
+ // };
+
+ // wx.onMenuShareAppMessage(shareData);//分享给好友
+ // wx.onMenuShareTimeline(shareData);//分享到朋友圈
+ // wx.onMenuShareQQ(shareData);//分享给手机QQ
+ // wx.onMenuShareWeibo(shareData);//分享腾讯微博
+ // wx.onMenuShareQZone(shareData);//分享到QQ空间
+
configShareForIndex('/')
});
wx.error(function (res) {
diff --git a/public/react/src/common/util/ShareUtil.js b/public/react/src/common/util/ShareUtil.js
index 24fffbf15..c4ec8a62a 100644
--- a/public/react/src/common/util/ShareUtil.js
+++ b/public/react/src/common/util/ShareUtil.js
@@ -1,4 +1,4 @@
-const host = window.location.host
+const host = window.location.protocol + '//' + window.location.host
const wx = window.wx
function share(shareData) {
try {
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
index f78d62637..b2767887d 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -220,6 +220,7 @@ export default class TPMsettings extends Component {
can_copy: undefined,
task_pass: undefined,
test_set_permission: undefined,
+ code_edit_permission: undefined,
hide_code: undefined,
code_hidden: undefined,
forbid_copy: undefined,
@@ -352,6 +353,7 @@ export default class TPMsettings extends Component {
task_pass: response.data.shixun.task_pass,
test_set_permission: response.data.shixun.test_set_permission,
hide_code: response.data.shixun.hide_code,
+ code_edit_permission: response.data.shixun.code_edit_permission,
code_hidden: response.data.shixun.code_hidden,
is_secret_repository: response.data.shixun.is_secret_repository,
init_is_secret_repository: response.data.shixun.is_secret_repository,
@@ -546,7 +548,11 @@ export default class TPMsettings extends Component {
});
}
-
+ code_edit_permission = (e) => {
+ this.setState({
+ code_edit_permission: e.target.checked
+ })
+ }
code_hidden=(e)=>{
let sum = ""
if (e.target.checked === false) {
@@ -869,7 +875,7 @@ export default class TPMsettings extends Component {
let {
name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, vnc_evaluate,
evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
- opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository
+ opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository, code_edit_permission
} = this.state;
let newshixun_service_configlist = shixun_service_configlist.map(v => {
@@ -982,6 +988,7 @@ export default class TPMsettings extends Component {
vnc_evaluate: vnc_evaluate===null?undefined:vnc_evaluate,
test_set_permission: test_set_permission,
code_hidden: code_hidden,
+ code_edit_permission: code_edit_permission,
trainee: trainee,
task_pass: task_pass,
hide_code: hide_code,
@@ -1563,6 +1570,7 @@ export default class TPMsettings extends Component {
test_set_permission,
hide_code,
forbid_copy,
+ code_edit_permission,
code_hidden,
vnc,
vnc_evaluate,
@@ -2274,6 +2282,15 @@ export default class TPMsettings extends Component {
+ {!code_hidden && !hide_code &&