Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

schedule_job
daiao 5 years ago
commit 344d261e22

@ -81,7 +81,7 @@ class AttendancesController < ApplicationController
old_group_ids = @attendance.course_attendance_groups.pluck(:course_group_id) old_group_ids = @attendance.course_attendance_groups.pluck(:course_group_id)
unless old_group_ids.include?(0) unless old_group_ids.include?(0)
all_groups_ids = old_group_ids + params[:group_ids] all_groups_ids = old_group_ids + params[:group_ids].map(&:to_i)
# 如果新增的的分班加上之前的分班是课堂的全部分班,则只需创建一条记录 # 如果新增的的分班加上之前的分班是课堂的全部分班,则只需创建一条记录
if all_groups_ids.uniq.count == @course.course_groups_count if all_groups_ids.uniq.count == @course.course_groups_count
@attendance.course_attendance_groups.destroy_all @attendance.course_attendance_groups.destroy_all

@ -614,31 +614,21 @@ class ExerciseQuestionsController < ApplicationController
@exercise_current_user.update!(ex_scores) @exercise_current_user.update!(ex_scores)
end end
comments = params[:comment] comments = params[:comment]
question_comment = @exercise_question.exercise_answer_comments&.first
if @exercise_question.question_type == Exercise::PRACTICAL
if question_comment.present? shixun_answer = ExerciseShixunAnswer.find_by(exercise_question_id: @exercise_question.id, user_id: @user_id, exercise_shixun_challenge_id: @shixun_a_id)
comment_option = { answer_comment = shixun_answer&.exercise_answer_comments.take
:comment => comments,
:score => @c_score,
:exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil,
:user_id => current_user.id
}
question_comment.update!(comment_option)
@exercise_comments = question_comment
else else
ex_answer_comment_id = @exercise_question.exercise_answers.find_by(user_id: @user_id).try(:id) question_answer = ExerciseAnswer.find_by(exercise_question_id: @exercise_question.id, user_id: @user_id)
comment_option = { answer_comment = question_answer&.exercise_answer_comments.take
:user_id => current_user.id, end
:comment => comments,
:score => @c_score,
:exercise_question_id => @exercise_question.id,
:exercise_shixun_answer_id => @shixun_a_id.present? ? @shixun_a_id : nil,
:exercise_answer_id => ex_answer_comment_id
}
@exercise_comments = ExerciseAnswerComment.new(comment_option)
@exercise_comments.save!
# 给被评阅人发送消息,同一个教师评阅无需重复发消息 if answer_comment.present?
answer_comment.update!(:comment => comments, :score => @c_score)
else
ExerciseAnswerComment.create!(:comment => comments, :score => @c_score, :user_id => current_user.id,
:exercise_question_id => @exercise_question.id, :exercise_shixun_answer_id => shixun_answer&.id,
:exercise_answer_id => question_answer&.id)
unless Tiding.where(user_id: @user_id, trigger_user_id: current_user.id, parent_container_id: @exercise.id, parent_container_type: "ExerciseScore").exists? unless Tiding.where(user_id: @user_id, trigger_user_id: current_user.id, parent_container_id: @exercise.id, parent_container_type: "ExerciseScore").exists?
Tiding.create!(user_id: @user_id, trigger_user_id: current_user.id, container_id: @exercise.id, Tiding.create!(user_id: @user_id, trigger_user_id: current_user.id, container_id: @exercise.id,
@ -646,8 +636,42 @@ class ExerciseQuestionsController < ApplicationController
parent_container_type: "ExerciseScore", belong_container_id: @course.id, parent_container_type: "ExerciseScore", belong_container_id: @course.id,
belong_container_type: 'Course', tiding_type: "Exercise") belong_container_type: 'Course', tiding_type: "Exercise")
end end
end end
# question_comment = @exercise_question.exercise_answer_comments&.first
#
# if question_comment.present?
# comment_option = {
# :comment => comments,
# :score => @c_score,
# :exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil,
# :user_id => current_user.id
# }
# question_comment.update!(comment_option)
# @exercise_comments = question_comment
# else
# ex_answer_comment_id = @exercise_question.exercise_answers.find_by(user_id: @user_id).try(:id)
# comment_option = {
# :user_id => current_user.id,
# :comment => comments,
# :score => @c_score,
# :exercise_question_id => @exercise_question.id,
# :exercise_shixun_answer_id => @shixun_a_id.present? ? @shixun_a_id : nil,
# :exercise_answer_id => ex_answer_comment_id
# }
# @exercise_comments = ExerciseAnswerComment.new(comment_option)
# @exercise_comments.save!
#
# # 给被评阅人发送消息,同一个教师评阅无需重复发消息
#
# unless Tiding.where(user_id: @user_id, trigger_user_id: current_user.id, parent_container_id: @exercise.id, parent_container_type: "ExerciseScore").exists?
# Tiding.create!(user_id: @user_id, trigger_user_id: current_user.id, container_id: @exercise.id,
# container_type: "Exercise", parent_container_id: @exercise.id,
# parent_container_type: "ExerciseScore", belong_container_id: @course.id,
# belong_container_type: 'Course', tiding_type: "Exercise")
# end
#
# end
end end
end end

@ -998,7 +998,7 @@ module ExercisesHelper
def has_comment? exercise_user, question_ids def has_comment? exercise_user, question_ids
exercise_answer_ids = exercise_user.user.exercise_answers.where(exercise_question_id: question_ids).pluck(:id) exercise_answer_ids = exercise_user.user.exercise_answers.where(exercise_question_id: question_ids).pluck(:id)
exercise_shixun_answer_ids = exercise_user.user.exercise_shixun_answers.where(exercise_question_id: question_ids).pluck(:id) exercise_shixun_answer_ids = exercise_user.user.exercise_shixun_answers.where(exercise_question_id: question_ids).pluck(:id)
exercise_user.commit_status == 1 && (exercise_user.exercise_user_scores.size > 0 || exercise_user.subjective_score >= 0.0 || exercise_user.commit_status == 1 && (exercise_user.exercise_user_scores.size > 0 ||
ExerciseAnswerComment.where(exercise_answer_id: exercise_answer_ids).or(ExerciseAnswerComment.where(exercise_shixun_answer_id: exercise_shixun_answer_ids)).exists?) ExerciseAnswerComment.where(exercise_answer_id: exercise_answer_ids).or(ExerciseAnswerComment.where(exercise_shixun_answer_id: exercise_shixun_answer_ids)).exists?)
end end
end end

@ -34,8 +34,10 @@ class Users::ShixunService
def status_filter(relations) def status_filter(relations)
case params[:category] case params[:category]
when 'study', 'collect' then when 'study' then
study_shixun_status_filter(relations) study_shixun_status_filter(relations)
when 'collect' then
collect_shixun_status_filter(relations)
when 'manage' then when 'manage' then
manage_shixun_status_filter(relations) manage_shixun_status_filter(relations)
else else
@ -66,6 +68,16 @@ class Users::ShixunService
relations relations
end end
def collect_shixun_status_filter relations
passed_shixun_ids = user.myshixuns.where(shixun_id: relations, status: 1).pluck(:shixun_id)
if params[:status] == 'passed'
relations = relations.where(id: passed_shixun_ids)
elsif params[:status] == 'processing'
relations = relations.where.not(id: passed_shixun_ids)
end
relations
end
def manage_shixun_status_filter(relations) def manage_shixun_status_filter(relations)
if params[:status] == "publiced" if params[:status] == "publiced"
relations = relations.where(public: 2) relations = relations.where(public: 2)
@ -99,9 +111,9 @@ class Users::ShixunService
end end
case params[:category] case params[:category]
when 'study', 'collect' then when 'study' then
relations.order("myshixuns.#{sort_by} #{sort_direction}") relations.order("myshixuns.#{sort_by} #{sort_direction}")
when 'manage' then when 'manage', 'collect' then
relations.order("shixuns.#{sort_by} #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")
else else
relations.order("shixuns.#{sort_by} #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")

@ -0,0 +1,10 @@
class MigrateExerciseShixunAnswerComment < ActiveRecord::Migration[5.2]
def change
ExerciseAnswerComment.where.not(exercise_shixun_answer_id: ExerciseShixunAnswer.all).where("exercise_shixun_answer_id is not null and exercise_answer_id is not null").each do |answer|
exercise_shixun_answer = ExerciseShixunAnswer.find_by(id: answer.exercise_answer_id)
if exercise_shixun_answer.present?
answer.update_columns(exercise_shixun_answer_id: exercise_shixun_answer&.id)
end
end
end
end

@ -1,6 +1,7 @@
class UniqIndexOnCollections < ActiveRecord::Migration[5.2] class UniqIndexOnCollections < ActiveRecord::Migration[5.2]
def change def change
remove_index :collections, [:container_type, :container_id] remove_index :collections, [:container_type, :container_id]
add_index :collections, [:container_type, :container_id], unique: true add_index :collections, [:container_type, :container_id]
add_index :collections, [:user_id, :container_type, :container_id], unique: true
end end
end end

@ -46,7 +46,7 @@ debugType = "admin";
// 老师 // 老师
// debugType="teacher"; // debugType="teacher";
// 学生 // 学生
// debugType="student"; debugType="student";

@ -443,7 +443,7 @@ class NewShixunModel extends Component{
<div> <div>
<style> <style>
{ {
`body{ width: calc(100%) !important; } `body{overflow: hidden !important; }
.ant-drawer-content{ overflow:auto !important; background: #f5f5f5; } .ant-drawer-content{ overflow:auto !important; background: #f5f5f5; }
.yslbottomsj{position: absolute;bottom: -8px;} .yslbottomsj{position: absolute;bottom: -8px;}
.ant-drawer-close{ .ant-drawer-close{

@ -175,7 +175,9 @@ class Teacherentry extends Component {
<div className="zcqiandao initials"> <div className="zcqiandao initials">
正常签到 正常签到
</div> </div>
:"" :item.attendance_status==="ABSENCE"&&item.attendance_mode==="TEACHER"?<div className="kkqiandao initials">
旷课
</div>:""
) )
: :
"" ""

@ -808,15 +808,14 @@ class TPMBanner extends Component {
setCollect=()=>{ setCollect=()=>{
let id = this.props.match.params.shixunId; let {shixunsDetails} = this.props;
let url ="/collections.json"; let url ="/collections.json";
axios.post(url,{ axios.post(url,{
container_id:id, container_id:shixunsDetails.id,
container_type:"Shixun" container_type:"Shixun"
}).then((result)=>{ }).then((result)=>{
const status = result.data.status const status = result.data.status
if(status===0){ if(status===0){
debugger
this.props.getcomponentdidmount() this.props.getcomponentdidmount()
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
} }
@ -826,15 +825,14 @@ class TPMBanner extends Component {
} }
cancelCollect=()=>{ cancelCollect=()=>{
let id = this.props.match.params.shixunId; let {shixunsDetails} = this.props;
let url=`/collections/cancel.json`; let url=`/collections/cancel.json`;
axios.delete(url,{ data:{ axios.delete(url,{ data:{
container_id:id, container_id:shixunsDetails.id,
container_type:"Shixun" container_type:"Shixun"
}}).then((response) => { }}).then((response) => {
const status = response.data.status const status = response.data.status
if(status===0){ if(status===0){
debugger
this.props.getcomponentdidmount() this.props.getcomponentdidmount()
this.props.showNotification(response.data.message); this.props.showNotification(response.data.message);
} }
@ -945,6 +943,7 @@ class TPMBanner extends Component {
.ant-popover{ .ant-popover{
z-index:1000 !important; z-index:1000 !important;
} }
body{ width: calc(100%) !important; }
` `
} }
</style> </style>
@ -1373,7 +1372,7 @@ class TPMBanner extends Component {
{this.props.identity < 8 && shixunsDetails.shixun_status != -1 && shixunsDetails.shixun_status != 0? {this.props.identity < 8 && shixunsDetails.shixun_status != -1 && shixunsDetails.shixun_status != 0?
<div className="fr kaike kkbth mr20" <div className="fr kaike kkbth mr20 width155"
style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}> style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}>
<Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}> <Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}>
<span className="flex1 edu-txt-center fl font-18" <span className="flex1 edu-txt-center fl font-18"
@ -1424,7 +1423,7 @@ class TPMBanner extends Component {
</Spin> : </Spin> :
<div> <div>
<div className="task-popup-content"> <div className="task-popup-content">
<div className={"forkfactors"}>请根据实际情况填写fork本实训的原因</div> <div className={"forkfactors"}>请根据实际情况填写复制本实训的原因</div>
<Radio.Group onChange={this.onChangeRadiovalue} value={this.state.Radiovalue} className={"ml20 mt20 mb20"} style={{ width: "100%" }}> <Radio.Group onChange={this.onChangeRadiovalue} value={this.state.Radiovalue} className={"ml20 mt20 mb20"} style={{ width: "100%" }}>
<Radio style={radioStyle} value={1}> <Radio style={radioStyle} value={1}>
实训内容升级 实训内容升级

@ -165,4 +165,8 @@ a:active{text-decoration:none;}
.forkfactors{ .forkfactors{
text-align: center; text-align: center;
color: #999999; color: #999999;
}
.width155{
width:150px !important;
} }

@ -243,7 +243,7 @@ class InfosShixun extends Component{
<li className={category == "collect" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a <li className={category == "collect" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a
onClick={() => this.changeCategory("collect")} onClick={() => this.changeCategory("collect")}
href="javascript:void(0)" href="javascript:void(0)"
className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习</a></li> className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}收藏</a></li>
</div> </div>
<style> <style>
{ {
@ -279,7 +279,7 @@ class InfosShixun extends Component{
onClick={() => this.changeStatus("closed")} className="w60" href="javascript:void(0)">已关闭</a></li> onClick={() => this.changeStatus("closed")} className="w60" href="javascript:void(0)">已关闭</a></li>
</div> </div>
} }
{ {
category && category == "study" && is_current && category && category == "study" && is_current &&
<div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE"> <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">

@ -122,7 +122,7 @@ function VideoInReviewItem (props) {
{ {
isReview !== true && !link ? isReview !== true && !link ?
<Tooltip title="复制" placement="bottom"> <Tooltip title="复制链接" placement="bottom">
<i className={`icon-fuzhi iconfont copybtn_item_${id}`} data-clipboard-text={getCopyText((play_url || file_url), cover_url)}></i> <i className={`icon-fuzhi iconfont copybtn_item_${id}`} data-clipboard-text={getCopyText((play_url || file_url), cover_url)}></i>
</Tooltip>:"" </Tooltip>:""
} }

Loading…
Cancel
Save