Merge branches 'dev_aliyun', 'dev_ysmnewshixun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_ysmnewshixun

chromesetting
杨树明 5 years ago
commit 4d5b0bd383

@ -78,7 +78,7 @@ class HomeworkCommonsController < ApplicationController
when '4'
sql_str = %Q((homework_detail_manuals.comment_status = #{order} and homework_detail_manuals.appeal_time > '#{Time.now}'))
when '5'
sql_str = %Q((homework_detail_manuals.comment_status = #{order} or (anonymous_comment = 0 and ((allow_late= 0 and homework_commons.end_time <= '#{Time.now}') or (allow_late= 1 and late_time <= '#{Time.now}')))))
sql_str = %Q((anonymous_comment = 0 or (anonymous_comment = 1 and homework_detail_manuals.comment_status = #{order})) and ((allow_late= 0 and homework_commons.end_time <= '#{Time.now}') or (allow_late= 1 and late_time <= '#{Time.now}')))
else
sql_str = %Q(homework_detail_manuals.comment_status = #{order})
end
@ -194,7 +194,6 @@ class HomeworkCommonsController < ApplicationController
end
@work_count = @student_works.size
@work_excel = @student_works.where("work_status > 0")
# 排序
rorder = params[:order].blank? ? "update_time" : params[:order]
@ -204,6 +203,7 @@ class HomeworkCommonsController < ApplicationController
elsif rorder == "student_id"
@student_works = @student_works.joins(user: :user_extension).order("user_extensions.#{rorder} #{b_order}")
end
@work_excel = @student_works
# 分页参数
page = params[:page] || 1

@ -22,21 +22,21 @@ module ExportHelper
end
end
shixun_homeworks = shixun_homeworks&.includes(:score_student_works)
shixun_homeworks = shixun_homeworks&.includes(:student_works)
common_homeworks = homeworks.search_homework_type(1) #全部普通作业
common_titles = common_homeworks.pluck(:name)+ ["总得分"]
common_homeworks = common_homeworks&.includes(:score_student_works)
common_homeworks = common_homeworks&.includes(:student_works)
group_homeworks = homeworks.search_homework_type(3) #全部分组作业
group_titles = group_homeworks.pluck(:name)+ ["总得分"]
group_homeworks = group_homeworks&.includes(:score_student_works)
group_homeworks = group_homeworks&.includes(:student_works)
task_titles = tasks.pluck(:name) + ["总得分"]
tasks = tasks&.includes(:score_graduation_works)
tasks = tasks&.includes(:graduation_works)
exercise_titles = exercises.pluck(:exercise_name) + ["总得分"]
exercises = exercises&.includes(:score_exercise_users)
exercises = exercises&.includes(:exercise_users)
total_user_score_array = [] #学生总成绩集合
@ -67,7 +67,7 @@ module ExportHelper
#实训作业
if shixun_homeworks.size > 0
shixun_homeworks.each do |s|
user_student_work = s.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
user_student_work = s.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work.nil?
h_score = 0.0 #该作业的得分为0
else
@ -82,7 +82,7 @@ module ExportHelper
#普通作业
if common_homeworks.size > 0
common_homeworks.each do |c|
user_student_work_1 = c.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
user_student_work_1 = c.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work_1.nil?
h_score_1 = 0.0 #该作业的得分为0
else
@ -97,7 +97,7 @@ module ExportHelper
#分组作业
if group_homeworks.size > 0
group_homeworks.each do |g|
user_student_work_3 = g.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
user_student_work_3 = g.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work_3.nil?
h_score_3 = 0.0 #该作业的得分为0
else
@ -112,7 +112,7 @@ module ExportHelper
#毕设作业
if tasks.size > 0
tasks.each do |task|
graduation_work = task.score_graduation_works.select{|work| work.user_id == user.id}.first
graduation_work = task.graduation_works.select{|work| work.user_id == user.id}.first
if graduation_work.nil?
t_score = 0.0
else
@ -127,7 +127,7 @@ module ExportHelper
#试卷
if exercises.size > 0
exercises.each do |ex|
exercise_work = ex.score_exercise_users.select{|work| work.user_id == user.id}.first
exercise_work = ex.exercise_users.select{|work| work.user_id == user.id}.first
if exercise_work.nil?
e_score = 0.0
else
@ -168,7 +168,7 @@ module ExportHelper
#实训作业
shixun_homeworks.each_with_index do |s,index|
all_student_works = s.score_student_works.where(user_id: all_user_ids) #该实训题的全部用户回答
all_student_works = s.student_works.where(user_id: all_user_ids) #该实训题的全部用户回答
title_no = index.to_i + 1
student_work_to_xlsx(all_student_works,s)
shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30)
@ -178,7 +178,7 @@ module ExportHelper
#普通作业
common_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
title_no = count_1 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
@ -190,7 +190,7 @@ module ExportHelper
#分组作业
group_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
title_no = count_1 + count_2 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@ -200,7 +200,7 @@ module ExportHelper
#毕设任务
tasks.each_with_index do |c,index|
all_student_works = c.score_graduation_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.graduation_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + index.to_i + 1
graduation_work_to_xlsx(all_student_works,c,current_user)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@ -210,7 +210,7 @@ module ExportHelper
#试卷的导出
exercises.each_with_index do |c,index|
all_student_works = c.score_exercise_users.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.exercise_users.where(user_id: all_user_ids) #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
get_export_users(c,course,all_student_works)
work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30)
@ -429,7 +429,7 @@ module ExportHelper
end
else #实训题
shixun = homework.shixuns.take
shixun_head_cells = %w(完成情况 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
shixun_head_cells = %w(截止前完成关卡 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
eff_boolean = homework.work_efficiency
if eff_boolean
eff_score_cell = ["效率分"]
@ -455,16 +455,18 @@ module ExportHelper
course_name = course.students.find_by(user_id: w.user_id).try(:course_group_name)
w_5 = course_name.present? ? course_name : "--"
#0 未提交, 1 按时提交, 2 延迟提交
if w.work_status == 0
w_6 = "未提交"
elsif w.work_status == 1
w_6 = "按时提交"
elsif w.work_status == 2
w_6 = "延迟提交"
if w.compelete_status == 0
w_6 = "未开启"
elsif w.compelete_status == 1
w_6 = "未通关"
elsif w.compelete_status == 2
w_6 = "按时通关"
elsif w.compelete_status == 3
w_6 = "迟交通关"
else
w_6 = "--"
end
w_7 = w.work_status == 0 ? '--' : myshixun.try(:passed_count).to_s+"/"+shixun.challenges_count.to_s
w_7 = myshixun&.time_passed_count(homework.homework_group_setting(w.user_id)&.end_time).to_i.to_s+"/"+shixun.challenges_count.to_s
w_8 = myshixun ? myshixun.try(:passed_time).to_s == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间
w_9 = myshixun ? (myshixun.try(:passed_count).to_i > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时
w_10 = myshixun ? myshixun.output_times : 0 #评测次数

@ -28,6 +28,13 @@ module HomeworkCommonsHelper
if ho_detail_manual
# 作业状态大于“提交”状态时,不用考虑分班权限
if ho_detail_manual.comment_status > 1
if homework_common.end_time && homework_common.end_time < Time.now && homework_common.allow_late &&
(homework_common.late_time.nil? || homework_common.late_time > Time.now)
status << "补交中"
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
end
case ho_detail_manual.comment_status
when 3
if ho_detail_manual.evaluation_end && ho_detail_manual.evaluation_end > Time.now
@ -42,12 +49,7 @@ module HomeworkCommonsHelper
time_status = 4
end
else
if homework_common.end_time && homework_common.end_time < Time.now && homework_common.allow_late &&
(homework_common.late_time.nil? || homework_common.late_time > Time.now)
status << "补交中"
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
else
if status.blank?
status << "已截止"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
@ -73,6 +75,7 @@ module HomeworkCommonsHelper
time_status = 1
elsif homework_common.end_time && homework_common.end_time < Time.now
if homework_common.allow_late && (homework_common.late_time.nil? || homework_common.late_time >= Time.now)
status << "补交中"
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
else

@ -285,7 +285,7 @@ class Shixun < ApplicationRecord
end
def has_manager?(user)
return true if user.admin?
return true if user.admin? || user.business?
shixun_members.where(role: [1, 2]).exists?(user_id: user.id)
end

@ -34,6 +34,7 @@ elsif @user_course_identity == Course::STUDENT
if @homework.homework_type == "practice"
json.(@work, :id, :update_time, :ultimate_score)
myshixun = @work.myshixun || @shixun.myshixuns.find_by(user_id: @work.user_id)
json.calculation_time @work.calculation_time
json.late_penalty @work.late_penalty if @homework.allow_late
json.cost_time @work.myshixun.try(:total_spend_time)
@ -41,7 +42,7 @@ elsif @user_course_identity == Course::STUDENT
json.final_score work_score_format(@work.final_score, true, @score_open)
json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.current_complete_count @work.myshixun.try(:passed_count) if @homework.end_or_late
json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late
json.complete_count @work.myshixun&.time_passed_count(@homework.homework_group_setting(@work.user_id)&.end_time)
json.view_answer_count @work.myshixun.try(:view_answer_count).to_i
json.work_status @work.compelete_status
@ -90,6 +91,7 @@ if @homework.homework_type == "practice"
json.student_works @student_works.each do |work|
json.(work, :id, :update_time, :ultimate_score, :myshixun_id)
myshixun = work.myshixun || @shixun.myshixuns.find_by(user_id: work.user_id)
json.late_penalty work.late_penalty if @homework.allow_late
json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open)
@ -98,7 +100,7 @@ if @homework.homework_type == "practice"
json.eff_score work_score_format(work.eff_score, @current_user == work.user, @score_open)
json.cost_time work.myshixun.try(:total_spend_time)
json.current_complete_count work.myshixun.try(:passed_count) if @homework.end_or_late
json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late
json.complete_count work.myshixun&.time_passed_count(@homework.homework_group_setting(work.user_id)&.end_time)
json.view_answer_count work.myshixun.try(:view_answer_count).to_i
json.user_login work.user.try(:login)

@ -18,5 +18,6 @@ json.shixuns_list do
json.challenges_count shixun.challenges_count
json.complete_status stage_myshixun_status(myshixuns.select{|ms| ms.shixun_id == shixun.id}.first)
json.shixun_status stage_shixun_status(subject.status, shixun.status, shixun.hidden)
json.allow_visit User.current.shixun_permission(shixun)
end
end

@ -35,7 +35,7 @@ if (isDev) {
// 老师
//ebugType="teacher";
// 学生
//debugType="student";
// debugType="student";
window._debugType = debugType;
export function initAxiosInterceptors(props) {

@ -492,13 +492,13 @@ class YslDetailCards extends Component{
:<i className="iconfont icon-bofang progressRing-part font-18 mt10"></i>
}
</span>
<span className={this.props.current_user&&this.props.current_user.admin===false&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?"paragraph_name color204":"paragraph_name color-grey3"}>
<span className={line.allow_visit===false&&line.shixun_status==="暂未公开"?"paragraph_name color204":"paragraph_name color-grey3"}>
<span className="subject_stage_shixun_index">{key+1}</span>-{index+1}&nbsp;&nbsp;{line.shixun_name}
</span>
</li>
{
this.props.current_user&&this.props.current_user.admin===false&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?
line.allow_visit===false&&line.shixun_status==="暂未公开"?
<li className="fr status_li"><span className="fr color204">暂未公开</span></li>
:
<li className={showparagraph===false?"none":"fr status_li"}>
@ -512,7 +512,7 @@ class YslDetailCards extends Component{
</li>
}
{this.props.current_user&&this.props.current_user.admin===false&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?"": <li className={showparagraph===false?"fr status_li":"fr status_li"}>
{line.allow_visit===false&&line.shixun_status==="暂未公开"?"": <li className={showparagraph===false?"fr status_li":"fr status_li"}>
{
showparagraphkey === key && showparagraphindex === index ? "" :
<span className="fr color204">实验任务 <span

@ -341,6 +341,7 @@ class DetailCards extends Component{
}=this.state;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
// console.log("zzz"+this.props.MenuItemsindextype)
// console.log(this.props.detailInfoList&&this.props.detailInfoList.allow_visit)
return(
<div>
@ -547,13 +548,13 @@ class DetailCards extends Component{
:<i className="iconfont icon-bofang progressRing-part font-18 mt10"></i>
}
</span>
<span className={this.props.current_user&&this.props.current_user.admin===false&&line.shixun_status==="暂未公开"?"paragraph_name color204":"paragraph_name color-grey3"}>
<span className={line.allow_visit===false&&line.shixun_status==="暂未公开"?"paragraph_name color204":"paragraph_name color-grey3"}>
<span className="subject_stage_shixun_index">{key+1}</span>-{index+1}&nbsp;&nbsp;{line.shixun_name}
</span>
</li>
{
this.props.current_user&&this.props.current_user.admin===false&&line.shixun_status==="暂未公开"?
line.allow_visit===false&&line.shixun_status==="暂未公开"?
<li className="fr status_li"><span className="fr color204">暂未公开</span></li>
:
<li className={showparagraph===false?"none":"fr status_li"}>

Loading…
Cancel
Save