Merge branch 'dev_aliyun' into develop

dev_hs
cxt 5 years ago
commit 1694ae7f48

@ -83,12 +83,13 @@ module ExercisesHelper
@ex_sub_array = @ex_sub_array.sort_by {|k| k[:q_position]}
end
#试卷的统计结果页面计算各题的
#试卷的统计结果页面计算各题的。选择题和判断题原来是按已回答了本题的人数来计算的。现需要按已提交试卷的人数来计算。2019-8-23
def exercise_commit_result(questions,user_ids)
question_infos = []
percent = 0.0
commit_user_ids = user_ids.size
questions.includes(:exercise_choices).each do |ex|
ex_total_score = user_ids.count * ex&.question_score.to_f #该试卷的已回答的总分
ex_total_score = commit_user_ids * ex&.question_score.to_f #该试卷的已回答的总分
# ex_answers = ex.exercise_answers
if ex.question_type != Exercise::PRACTICAL
ques_title = ex.question_title
@ -103,7 +104,7 @@ module ExercisesHelper
end
effictive_users_count = effictive_users.size #有效回答数可能有重复的用户id这里仅统计是否回答这个问题的全部人数
#
if ex.question_type > Exercise::COMPLETION #当为主观题和实训题时,
ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分
percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率
@ -113,8 +114,8 @@ module ExercisesHelper
if ex.question_type <= Exercise::JUDGMENT #选择题和判断题
ex_choices = ex.exercise_choices
standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置
right_users_count = 0
#该问题的正确率
# right_users_count = 0
# 该问题的正确率
if ex.question_type == Exercise::MULTIPLE #多选题
right_user_ids = user_ids
standard_answer.each do |choice_position|
@ -122,19 +123,12 @@ module ExercisesHelper
right_user_ids = right_user_ids & effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.pluck(:user_id)
end
right_users_count = right_user_ids.size
# user_ids.each do |user_id|
# ex_choice_ids = effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}.reject(&:blank?).uniq
# answer_choice_array = ex_choices.map{|a| a.choice_position if ex_choice_ids.include?(a.id)}.reject(&:blank?).uniq
# if answer_choice_array.sort == standard_answer
# right_users_count += 1
# end
# end
else #单选题和判断题
standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == standard_answer.first}.first&.id
right_users_count = effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.size
end
percent = effictive_users_count > 0 ? (right_users_count / effictive_users_count.to_f).round(3)*100 : 0.0
percent = commit_user_ids > 0 ? (right_users_count / commit_user_ids.to_f).round(3)*100 : 0.0
#每个选项的正确率
ex_choices.each do |c|
@ -180,7 +174,8 @@ module ExercisesHelper
all_user_count += user_count
standard_answer_count += 1
end
percent = effictive_users_count > 0 ? (all_user_count / effictive_users_count.to_f).round(3)*100 : 0.0
percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
user_wrong_count = (effictive_users_count - all_user_count )
if effictive_users_count > 0 && user_wrong_count >= 0

@ -19,7 +19,7 @@ class Attachment < ApplicationRecord
scope :contains_only_project, -> { where(container_type: 'Project') }
scope :contains_course_and_project, -> { contains_only_course.or(contains_only_project) }
scope :mine, -> (author_id) { where(author_id: author_id) }
scope :simple_columns, -> { select(:id, :filename, :filesize, :created_on, :cloud_url, :author_id) }
scope :simple_columns, -> { select(:id, :filename, :filesize, :created_on, :cloud_url, :author_id, :content_type) }
scope :search_by_container, -> (ids) {where(container_id: ids)}
validates_length_of :description, maximum: 100

@ -10,6 +10,7 @@ rescue => ex
puts %Q{\033[33m [warning] aliyun vod config or configuration.yml missing,
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
aliyun_vod_config = {}
end
AliyunVod.access_key_id = aliyun_vod_config['access_key_id']

@ -0,0 +1,9 @@
class AddMessageCountForBoards < ActiveRecord::Migration[5.2]
def change
boards = Board.where(:parent_id => 0)
Board.reset_column_information
boards.find_each do |board|
Board.reset_counters board.id, :messages
end
end
end

@ -0,0 +1,18 @@
class ChangeExericse1936Scores < ActiveRecord::Migration[5.2]
def change
#1936的试卷成绩有问题。
# #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts
ex_special = Exercise.find_by_id(1936)
ex_special_users = ex_special&.exercise_users&.exercise_user_committed&.where("end_at is not null and end_at > ?",Time.now - 2.months)
if ex_special.present? && ex_special_users.exists?
ex_special_users.each do |ex_user|
calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score]
subjective_score = ex_user.subjective_score
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = calculate_score + total_score_subjective_score
ex_user.update_attributes(score:total_score,objective_score:calculate_score)
puts ex_user.id
end
end
end
end

@ -0,0 +1,42 @@
class ModifyCourseIntroductionForBoards < ActiveRecord::Migration[5.2]
def change
platform = PlatformSample.where(:samples_type => "courseGuide").first
content = '
线
线
- Python[Python](https://www.educoder.net/paths/13) | [Python](https://www.educoder.net/paths/11)
- Java[Java](https://www.educoder.net/paths/38)
- C/C++[C/C++](https://www.educoder.net/paths/3) | [C](https://www.educoder.net/paths/4)
- Matlab[MATLAB](https://www.educoder.net/shixuns/7bvs54gw/challenges) | [](https://www.educoder.net/shixuns/q4fowkfa/challenges) | [](https://www.educoder.net/shixuns/grunzcs3/challenges)
- HTML/CSS[HTML5+CSS3](https://www.educoder.net/paths/15)
- [Docker](https://www.educoder.net/paths/29)
... ...
'
platform.update_column(:contents, content)
messages = Message.where(subject: "新课导语")
messages.find_each do |m|
m.update_column(:is_md, true)
message_detail = m.message_detail
message_detail.update_column(:content, content) if message_detail
end
end
end

@ -1,72 +1,80 @@
.studentList_operation_ul{
color: #999;
font-size: 12px;
float: right;
margin-top: 2px;
}
.studentList_operation_ul li{
float: left;
padding:0px 20px;
position: relative;
cursor: pointer;
flex: 0 0 26px;
line-height: 26px;
}
.studentList_operation_ul li.li_line:after{
position: absolute;
content: '';
width: 1px;
height: 12px;
background-color: #EDEDED;
right: 0px;
top:6px;
}
.studentList_operation_ul li:last-child{
padding-right: 0px;
}
.studentList_operation_ul li:last-child:after{
width: 0px;
}
/* 基础的下拉列表、列如排序等 */
.drop_down_normal li{
padding: 0px 20px;
height: 34px;
line-height: 34px;
min-width: 96px;
color: #333;
font-size: 14px;
cursor: pointer;
width: 100%;
}
.stu_table table{
line-height: 1.2;
}
.stu_table .classesName{
display: block;
max-width: 428px;
}
.stu_table .ant-table-thead > tr > th{
padding:21px 16px;
border-bottom: none;
}
.stu_table .ant-table-tbody tr:last-child td{
border-bottom: none;
}
.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{
background-color: #fff;
}
.stu_head{
padding-bottom: 15px;
}
.ant-modal-body{
padding:30px 40px;
}
.color-dark-21{
color: #212121;
}
.tabletd {
background-color:#E6F7FF;
}
.studentList_operation_ul{
color: #999;
font-size: 12px;
float: right;
margin-top: 2px;
}
.studentList_operation_ul li{
float: left;
padding:0px 20px;
position: relative;
cursor: pointer;
flex: 0 0 26px;
line-height: 26px;
}
.studentList_operation_ul li.li_line:after{
position: absolute;
content: '';
width: 1px;
height: 12px;
background-color: #EDEDED;
right: 0px;
top:6px;
}
.studentList_operation_ul li:last-child{
padding-right: 0px;
}
.studentList_operation_ul li:last-child:after{
width: 0px;
}
/* 基础的下拉列表、列如排序等 */
.drop_down_normal li{
padding: 0px 20px;
height: 34px;
line-height: 34px;
min-width: 96px;
color: #333;
font-size: 14px;
cursor: pointer;
width: 100%;
}
.stu_table table{
line-height: 1.2;
}
.stu_table .classesName{
display: block;
max-width: 428px;
}
.stu_table .ant-table-thead > tr > th{
padding:21px 16px;
border-bottom: none;
}
.stu_table .ant-table-tbody tr:last-child td{
border-bottom: none;
}
.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{
background-color: #fff;
}
.stu_head{
padding-bottom: 15px;
}
.ant-modal-body{
padding:30px 40px;
}
.color-dark-21{
color: #212121;
}
.tabletd {
background-color:#E6F7FF;
}
.yslminheigth{
min-height: 20px;
}
.yslminheigths{
min-height: 21px;
}

@ -60,22 +60,40 @@ class Elearning extends Component{
isSpin:false,
})
});
try {
if(this.props.current_user!==undefined){
this.setState({
userlogin :this.props.current_user.login,
})
}
}catch (e) {
console.log("12312312312")
console.log(e);
}
this.setState({
userlogin:this.props.current_user.login,
})
}
componentDidUpdate = (prevProps) => {
console.log("componentDidUpdate");
console.log(prevProps);
console.log(this.props);
if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user!==undefined){
// console.log(this.props.current_user.login);
// console.log(prevProps.current_user.login);
this.setState({
userlogin :this.props.current_user.login,
})
}
}
}
};
//开始学习
Startlearning=()=>{
let {userlogin} = this.state;
console.log("userlogin");
console.log(userlogin);
if (userlogin === undefined) {
this.setState({
isRender: true
@ -125,7 +143,6 @@ class Elearning extends Component{
console.log("精品课堂开发学习");
console.log(response);
// console.log(JSON.stringify(response));
debugger
if (response.data.status === -2) {
this.setState({

@ -236,11 +236,11 @@ class TraineetraininginformationModal extends Component {
</div>
<div className="fl edu-back-white ml20 mt15">
<li>{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.username}<span style={{"color":"#323232"}}> 通关</span><span style={{"color": '#FF6800'}}>{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.complete_count}/{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.challenges_count}</span></li>
<li><span style={{"color":"#989898"}} >完成效率</span><span style={{"color":"#4C4C4C"}}>{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.efficiency}</span></li>
{this.props.viewtrainingdata === undefined ? <li className="yslminheigth"></li> :this.props.viewtrainingdata.efficiency === undefined ? <li className="yslminheigth"></li> :this.props.viewtrainingdata.efficiency === null ? <li className="yslminheigth"></li> :this.props.viewtrainingdata.efficiency === "null" ? <li className="yslminheigth"></li> :this.props.viewtrainingdata.efficiency === "" ? <li className="yslminheigth"></li> : <li><span style={{"color":"#989898"}} ></span><span style={{"color":"#4C4C4C"}}>{this.props.viewtrainingdata.efficiency}</span></li>}
<li><span style={{"color":"#989898"}}>通关时间</span> <span style={{"color":"#4C4C4C"}}>{this.props.viewtrainingdata === undefined ? "":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"--":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')}</span> </li>
</div>
<div className="fl edu-back-white ml20 mt15">
<li className="mt20"> <span style={{"color":"#989898"}}>课堂最高完成效率</span> <span style={{"color":"#4C4C4C"}}>{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.max_efficiency} </span> </li>
{this.props.viewtrainingdata === undefined ? <li className="yslminheigth mt20"></li> :this.props.viewtrainingdata.max_efficiency === undefined ? <li className="yslminheigth mt20"></li> :this.props.viewtrainingdata.max_efficiency === null ? <li className="yslminheigth mt20"></li> :this.props.viewtrainingdata.max_efficiency === "null" ? <li className="yslminheigth mt20"></li>: this.props.viewtrainingdata.max_efficiency === "" ? <li className="yslminheigth mt20"></li> : <li className="mt20"> <span style={{"color":"#989898"}}></span> <span style={{"color":"#4C4C4C"}}>{this.props.viewtrainingdata.max_efficiency} </span> </li>}
<li><span style={{"color":"#989898"}}>总耗时:</span> <span style={{"color":"#4C4C4C"}}> {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.total_spend_time}</span> </li>
</div>

@ -322,9 +322,14 @@ class Trainingjobsetting extends Component {
};
challenge_scoredata.push(datas[i].challenge_score);
array.push(object)
console.log("datas[i].challenge_score");
console.log(i);
console.log(datas[i].challenge_score);
}
}
console.log("提交的数据"+"pustdate");
console.log("提交的数据"+"pustdate");
if (this.state.jobsettingsdata.data.unified_setting === true) {
if (this.state.unifiedsetting === true) {
@ -560,14 +565,20 @@ class Trainingjobsetting extends Component {
if(challenge_scoredata.length>0){
var len = 0;
for (var k = 0; k < challenge_scoredata.length; k++) {
len = len + challenge_scoredata[k];
len = len + parseFloat(challenge_scoredata[k]);
console.log(len);
console.log(challenge_scoredata[k]);
console.log(len);
}
var max = latedeductiontwos + len;
if (max > 100) {
console.log("max>100");
this.props.showNotification(`总分值+效率占比分之和要等于100现在分值为` + max);
return;
}
if(max<100){
console.log("max<100");
this.props.showNotification(`总分值+效率占比分之和要等于100现在分值为` + max);
return;
}

@ -95,6 +95,10 @@ a:hover.link-color-grey03{color:#3498db!important;}
/*通用文字大小样式*/
.font-8{ font-size: 8px!important;}
.font-9{ font-size: 9px!important;}
.font-10{ font-size: 10px!important;}
.font-11{ font-size: 11px!important;}
.font-12{ font-size: 12px!important;}
.font-13{ font-size: 13px!important;}
.font-14{ font-size: 14px!important;}

Loading…
Cancel
Save