Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_aliyun_beta
杨树明 5 years ago
commit e1b92602e7

@ -234,6 +234,9 @@ class ChallengesController < ApplicationController
# {...}, ...] # {...}, ...]
#} #}
def crud_answer def crud_answer
if @challenge.challenge_answers && params[:challenge_answer].blank?
@challenge.challenge_answers.destroy_all
else
raise '参考答案不能为空' if params[:challenge_answer].empty? raise '参考答案不能为空' if params[:challenge_answer].empty?
raise '占比之和必须为100%' if params[:challenge_answer].map{|a| a[:score]}.sum != 100 raise '占比之和必须为100%' if params[:challenge_answer].map{|a| a[:score]}.sum != 100
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
@ -245,7 +248,7 @@ class ChallengesController < ApplicationController
level: index+1, score: answer[:score], challenge_id: @challenge.id) level: index+1, score: answer[:score], challenge_id: @challenge.id)
end end
end end
end
end end
# 查看参考答案接口 # 查看参考答案接口

@ -172,17 +172,17 @@ class FilesController < ApplicationController
attachment_ids.each do |attachment_id| attachment_ids.each do |attachment_id|
ori = Attachment.find_by_id(attachment_id) ori = Attachment.find_by_id(attachment_id)
# 同一个资源可以多次发送到课堂 # 同一个资源可以多次发送到课堂
@course.attachments.each do |att| # @course.attachments.each do |att|
@exist = false # @exist = false
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from # if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now # att.created_on = Time.now
att.save # att.save
@exist = true # @exist = true
break # break
end # end
end # end
#
next if @exist # next if @exist
attach_copied_obj = ori.copy attach_copied_obj = ori.copy
attach_copied_obj.container = @course attach_copied_obj.container = @course
attach_copied_obj.created_on = Time.now attach_copied_obj.created_on = Time.now

@ -92,6 +92,7 @@ class StudentWorksController < ApplicationController
student_work.commit_time = Time.now student_work.commit_time = Time.now
student_work.update_time = Time.now student_work.update_time = Time.now
student_work.commit_user_id = current_user.id student_work.commit_user_id = current_user.id
student_work.update_user_id = current_user.id
student_work.group_id = @homework.homework_type == "group" ? @homework.max_group_id : 0 student_work.group_id = @homework.homework_type == "group" ? @homework.max_group_id : 0
#提交作品时,计算是否迟交 #提交作品时,计算是否迟交
@ -112,7 +113,7 @@ class StudentWorksController < ApplicationController
homework_common_id: @homework.id, project_id: student_work.project_id, homework_common_id: @homework.id, project_id: student_work.project_id,
late_penalty: student_work.late_penalty, work_status: student_work.work_status, late_penalty: student_work.late_penalty, work_status: student_work.work_status,
commit_time: Time.now, update_time: Time.now, group_id: student_work.group_id, commit_time: Time.now, update_time: Time.now, group_id: student_work.group_id,
commit_user_id: current_user.id) commit_user_id: current_user.id, update_user_id: current_user.id)
stu_work.save! stu_work.save!
student_work.attachments.each do |attachment| student_work.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
@ -156,6 +157,7 @@ class StudentWorksController < ApplicationController
begin begin
@work.description = params[:description] @work.description = params[:description]
@work.update_time = Time.now @work.update_time = Time.now
@work.update_user_id = current_user.id
# @work.commit_user_id = current_user.id # @work.commit_user_id = current_user.id
if @work.save! if @work.save!
Attachment.associate_container(params[:attachment_ids], @work.id, @work.class) Attachment.associate_container(params[:attachment_ids], @work.id, @work.class)
@ -172,7 +174,7 @@ class StudentWorksController < ApplicationController
# 原成员更新描述、更新时间以及附件 # 原成员更新描述、更新时间以及附件
@homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work| @homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work|
# work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id) # work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id)
work.update_attributes(update_time: Time.now, description: @work.description) work.update_attributes(update_time: Time.now, description: @work.description, update_user_id: current_user.id)
work.attachments.destroy_all work.attachments.destroy_all
@work.attachments.each do |attachment| @work.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
@ -192,7 +194,7 @@ class StudentWorksController < ApplicationController
@homework.student_works.where(group_id: @work.group_id, user_id: delete_user_ids). @homework.student_works.where(group_id: @work.group_id, user_id: delete_user_ids).
update_all(work_status: 0, description: nil, late_penalty: 0, commit_time: nil, update_time: nil, update_all(work_status: 0, description: nil, late_penalty: 0, commit_time: nil, update_time: nil,
final_score: nil, teacher_score: nil, student_score: nil, teaching_asistant_score: nil, final_score: nil, teacher_score: nil, student_score: nil, teaching_asistant_score: nil,
work_score: nil, project_id: 0, group_id: 0, commit_user_id: nil) work_score: nil, project_id: 0, group_id: 0, commit_user_id: nil, update_user_id: nil)
# 新增加的成员 # 新增加的成员
(params_user_ids - work_user_ids).each do |user_id| (params_user_ids - work_user_ids).each do |user_id|
@ -200,7 +202,7 @@ class StudentWorksController < ApplicationController
stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id, stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id,
project_id: @work.project_id, late_penalty: @work.late_penalty, project_id: @work.project_id, late_penalty: @work.late_penalty,
work_status: @work.work_status, commit_time: Time.now, update_time: Time.now, work_status: @work.work_status, commit_time: Time.now, update_time: Time.now,
group_id: @work.group_id, commit_user_id: @work.commit_user_id) group_id: @work.group_id, commit_user_id: @work.commit_user_id, update_user_id: current_user.id)
@work.attachments.each do |attachment| @work.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
att.author_id = attachment.author_id att.author_id = attachment.author_id

@ -2,6 +2,7 @@ class StudentWork < ApplicationRecord
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 #学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交
belongs_to :user belongs_to :user
belongs_to :commit_user, class_name: 'User', foreign_key: :commit_user_id, optional: true belongs_to :commit_user, class_name: 'User', foreign_key: :commit_user_id, optional: true
belongs_to :update_user, class_name: 'User', foreign_key: :update_user_id, optional: true
belongs_to :homework_common belongs_to :homework_common
belongs_to :myshixun, optional: true belongs_to :myshixun, optional: true
has_many :student_works_evaluation_distributions, dependent: :destroy has_many :student_works_evaluation_distributions, dependent: :destroy

@ -1,2 +1,2 @@
json.status 1 json.status 1
json.message "创建参考答案成功" json.message "操作成功"

@ -5,7 +5,8 @@ json.is_evaluation @is_evaluation
json.author_name @is_evaluation ? "匿名" : @work.user.real_name json.author_name @is_evaluation ? "匿名" : @work.user.real_name
json.is_leader_work @work.user_id == @work.commit_user_id if @homework.homework_type == "group" json.is_leader_work @work.user_id == @work.commit_user_id if @homework.homework_type == "group"
json.is_author @is_author json.is_author @is_author
json.update_user_name @is_evaluation ? "匿名" : @work.commit_user.try(:real_name) json.commit_user_name @is_evaluation ? "匿名" : @work.commit_user.try(:real_name)
json.update_user_name @is_evaluation ? "匿名" : @work.update_user.try(:real_name)
json.update_atta @homework.late_duration && @is_author json.update_atta @homework.late_duration && @is_author

@ -0,0 +1,6 @@
class AddUpdateUserIdToStudentWorks < ActiveRecord::Migration[5.2]
def change
add_column :student_works, :update_user_id, :integer
StudentWork.update_all("update_user_id = commit_user_id")
end
end

@ -162,7 +162,7 @@ class CommonWorkAppraise extends Component{
let {course_name, homework_name, search, page, loadingstate, homework_status, reference_answer, let {course_name, homework_name, search, page, loadingstate, homework_status, reference_answer,
attachments, homework_id, project_info, work_members, is_evaluation, attachments, homework_id, project_info, work_members, is_evaluation,
description, update_user_name, update_time, commit_time, author_name, description, update_user_name, commit_user_name, update_time, commit_time, author_name,
revise_attachments, revise_reason, atta_update_user, atta_update_time, atta_update_user_login, revise_attachments, revise_reason, atta_update_user, atta_update_time, atta_update_user_login,
Modalstype,Modalstopval,ModalCancel,ModalSave,loadtype, is_leader_work Modalstype,Modalstopval,ModalCancel,ModalSave,loadtype, is_leader_work
} =this.state; } =this.state;
@ -237,7 +237,7 @@ class CommonWorkAppraise extends Component{
{ commit_time && { commit_time &&
<React.Fragment> <React.Fragment>
<span className={"color9B9B fr mr30"}>提交</span> <span className={"color9B9B fr mr30"}>提交</span>
<span className={"fr font-14 mr10 ml10"}>{author_name}</span> <span className={"fr font-14 mr10 ml10"}>{commit_user_name}</span>
<span className={" color9B9B fr"}> <span className={" color9B9B fr"}>
{moment(commit_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(commit_time).format('YYYY-MM-DD HH:mm')} {moment(commit_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(commit_time).format('YYYY-MM-DD HH:mm')}
</span> </span>

@ -740,7 +740,7 @@ render(){
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '147px' }} <div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '147px' }}
title={item.group_name && item.group_name.length > 9 ? item.group_name : ''} title={item.group_name && item.group_name.length > 9 ? item.group_name : ''}
>{item.group_name}</div> >{item.group_name}</div>
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '84px' }} <div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '99px' }}
title={item.student_id && item.student_id.length > 12 ? item.student_id : ''} title={item.student_id && item.student_id.length > 12 ? item.student_id : ''}
>{item.student_id}</div> >{item.student_id}</div>
<div className={"fl ml20"}>{item.commit_status===true?<span className={"color-orange"}>已提交</span> :""}</div> <div className={"fl ml20"}>{item.commit_status===true?<span className={"color-orange"}>已提交</span> :""}</div>
@ -784,7 +784,7 @@ render(){
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '147px' }} <div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '147px' }}
title={item.group_name && item.group_name.length > 9 ? item.group_name : ''} title={item.group_name && item.group_name.length > 9 ? item.group_name : ''}
>{item.group_name}</div> >{item.group_name}</div>
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '84px' }} <div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '99px' }}
title={item.student_id && item.student_id.length > 12 ? item.student_id : ''} title={item.student_id && item.student_id.length > 12 ? item.student_id : ''}
>{item.student_id}</div> >{item.student_id}</div>
{item.user_id != this.props.current_user.user_id ? {item.user_id != this.props.current_user.user_id ?

@ -633,6 +633,9 @@ class MemoNew extends Component {
}; };
return ( return (
<div > <div >
<p className="clearfix mb10 undefined cBreadcrumb"><a className="btn colorgrey fl hovercolorblue"
href="/forums">交流问答</a><span
className="color-grey-9 fl ml3 mr3"> / </span><span></span></p>
<div className="pt20 pl20 pr20 pb20 bor-bottom-greyE clearfix" style={{background: '#fff'}}> <div className="pt20 pl20 pr20 pb20 bor-bottom-greyE clearfix" style={{background: '#fff'}}>
<span className="fl font-16">{ memoId ? '编辑话题' : '发布话题'}</span> <span className="fl font-16">{ memoId ? '编辑话题' : '发布话题'}</span>
{/*<a href="/shixuns/mf98sgi3/settings" className="ring-green mt7 fr" id="edit_setting" {/*<a href="/shixuns/mf98sgi3/settings" className="ring-green mt7 fr" id="edit_setting"

@ -120,7 +120,9 @@ export default class TPManswer extends Component {
let urlAnswer = `/shixuns/${id}/challenges/${checkpointId}/answer.json`; let urlAnswer = `/shixuns/${id}/challenges/${checkpointId}/answer.json`;
axios.get(urlAnswer).then((response) => { axios.get(urlAnswer).then((response) => {
if (response.data) { if (response.data.status === 401) {
} else if (response.data) {
this.setState({ answers: response.data }) this.setState({ answers: response.data })
} }
}) })
@ -158,7 +160,7 @@ export default class TPManswer extends Component {
if (!isValidate) { if (!isValidate) {
return; return;
} }
if (totalScore != 100) { if (answersParams.length != 0 && totalScore != 100) {
this.props.showSnackbar("请先保证占比和为100%"); this.props.showSnackbar("请先保证占比和为100%");
return; return;
} }

Loading…
Cancel
Save