diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb
index 8c2c4fda1..6c9de071d 100644
--- a/app/controllers/student_works_controller.rb
+++ b/app/controllers/student_works_controller.rb
@@ -374,6 +374,7 @@ class StudentWorksController < ApplicationController
new_score.comment = params[:comment] if params[:comment] && params[:comment].strip != ""
new_score.user_id = current_user.id
new_score.student_work_id = @work.id
+ new_score.homework_common_id = @work.homework_common_id
# 如果作品是未提交的状态则更新为已提交
if @user_course_identity < Course::STUDENT && !new_score.score.nil? && @work.work_status == 0
@@ -553,8 +554,10 @@ class StudentWorksController < ApplicationController
# 分数不为空的历史评阅都置为失效
@work.student_works_scores.where.not(score: nil).update_all(is_invalid: 1)
reviewer_role = @user_course_identity == Course::ASSISTANT_PROFESSOR ? 2 : 1
- new_score = StudentWorksScore.new(student_work_id: @work.id, score: params[:score].to_f, comment: "使用调分功能调整了作业最终成绩:#{params[:comment]}",
- user_id: current_user.id, reviewer_role: reviewer_role, is_ultimate: 1)
+ new_score = StudentWorksScore.new(student_work_id: @work.id, score: params[:score].to_f,
+ comment: "使用调分功能调整了作业最终成绩:#{params[:comment]}",
+ homework_common_id: @work.homework_common_id, user_id: current_user.id,
+ reviewer_role: reviewer_role, is_ultimate: 1)
new_score.save!
# 如果作品是未提交的状态则更新为已提交
@@ -844,7 +847,7 @@ class StudentWorksController < ApplicationController
def add_score_to_member student_work, homework, new_score
student_works = homework.student_works.where("group_id = #{student_work.group_id} and id != #{student_work.id} and ultimate_score = 0")
student_works.each do |st_work|
- st_score = StudentWorksScore.new(user_id: new_score.user_id, score: new_score.score,
+ st_score = StudentWorksScore.new(user_id: new_score.user_id, score: new_score.score, homework_common_id: homework.id,
reviewer_role: new_score.reviewer_role, comment: new_score.comment)
score = StudentWorksScore.where(user_id: new_score.user_id, student_work_id: st_work.id, reviewer_role: new_score.reviewer_role).last
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index 7da7a177d..a6a919981 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -6,6 +6,7 @@ class HomeworkCommon < ApplicationRecord
has_many :student_works, -> { where(is_delete: 0) }
has_many :score_student_works, -> { where("is_delete = 0 and work_status != 0").order("work_score desc") }, class_name: "StudentWork"
has_one :homework_detail_manual, dependent: :destroy
+ has_many :student_works_scores
# 分组作业的设置
has_one :homework_detail_group, dependent: :destroy
diff --git a/app/models/student_work.rb b/app/models/student_work.rb
index a4ae63f04..462e06adc 100644
--- a/app/models/student_work.rb
+++ b/app/models/student_work.rb
@@ -46,7 +46,17 @@ class StudentWork < ApplicationRecord
# 匿评次数
def student_comment_num
- homework_common.homework_detail_manual.comment_status > 2 ? self.student_works_scores.select{|score| score.reviewer_role == 3}.group_by(&:user_id).count : 0
+ homework_common.homework_detail_manual.comment_status > 2 && work_status > 0 ? self.student_works_scores.select{|score| score.reviewer_role == 3}.group_by(&:user_id).count : 0
+ end
+
+ # 学生评阅作品数
+ def user_comment_num
+ if homework_common.homework_detail_manual.comment_status > 2 && work_status > 0
+ count = homework_common.student_works_scores.select{|score| score.reviewer_role == 3 && score.user_id == user_id}.group_by(&:student_work_id).count
+ else
+ count = 0
+ end
+ count
end
# 匿评申诉总条数
diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb
index a193d4e77..c978d10a8 100644
--- a/app/models/student_works_score.rb
+++ b/app/models/student_works_score.rb
@@ -2,6 +2,7 @@ class StudentWorksScore < ApplicationRecord
#appeal_status: 0:正常;1:申诉中,2:撤销申诉;3:申诉成功;4:申诉被拒绝;5:申诉失效
belongs_to :student_work
belongs_to :user
+ belongs_to :homework_common, optional: true
has_many :journals_for_messages, -> { order('created_on desc') }, as: :jour, dependent: :destroy
has_one :student_works_scores_appeal, dependent: :destroy
has_many :tidings, as: :container, dependent: :destroy
diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder
index 9fb2d6971..4faea3474 100644
--- a/app/views/homework_commons/works_list.json.jbuilder
+++ b/app/views/homework_commons/works_list.json.jbuilder
@@ -63,6 +63,7 @@ elsif @user_course_identity == Course::STUDENT
if @homework.anonymous_comment
json.student_comment_count @work.student_comment_num
+ json.user_comment_count @work.user_comment_num
json.absence_penalty @work.absence_penalty
end
@@ -147,7 +148,8 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal"
# 作品匿评条数
if @homework.anonymous_comment
- json.student_comment_count @homework_detail_manual.comment_status > 2 ? work.student_comment_num : 0
+ json.student_comment_count @homework_detail_manual.comment_status > 2 && work.work_status > 0 ? work.student_comment_num : 0
+ json.user_comment_count @homework_detail_manual.comment_status > 2 && work.work_status > 0 ? work.user_comment_num : 0
json.absence_penalty work.absence_penalty
end
diff --git a/db/migrate/20200310081817_add_homework_common_id_to_student_works_score.rb b/db/migrate/20200310081817_add_homework_common_id_to_student_works_score.rb
new file mode 100644
index 000000000..bef02e7e1
--- /dev/null
+++ b/db/migrate/20200310081817_add_homework_common_id_to_student_works_score.rb
@@ -0,0 +1,5 @@
+class AddHomeworkCommonIdToStudentWorksScore < ActiveRecord::Migration[5.2]
+ def change
+ add_column :student_works_scores, :homework_common_id, :integer, default: 0, index: true
+ end
+end
diff --git a/db/migrate/20200310082003_migrate_student_works_score_homework.rb b/db/migrate/20200310082003_migrate_student_works_score_homework.rb
new file mode 100644
index 000000000..3b8c1c10d
--- /dev/null
+++ b/db/migrate/20200310082003_migrate_student_works_score_homework.rb
@@ -0,0 +1,7 @@
+class MigrateStudentWorksScoreHomework < ActiveRecord::Migration[5.2]
+ def change
+ StudentWorksScore.includes(:student_work).find_each do |score|
+ score.update_column("homework_common_id", score.student_work&.homework_common_id)
+ end
+ end
+end
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
index 255a74295..ae5771507 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
@@ -247,8 +247,8 @@ class CommonWorkDetailIndex extends Component{
`}
{current_user &&
{tableData && tableData.graduation_topic_name}
{topicId==undefined?"新建":"编辑"}毕设选题
-
+
)
}
-export default CourseGroupListTable
\ No newline at end of file
+export default CourseGroupListTable
diff --git a/public/react/src/modules/courses/poll/PollDetailTabFirst.js b/public/react/src/modules/courses/poll/PollDetailTabFirst.js
index 052382067..912894a9b 100644
--- a/public/react/src/modules/courses/poll/PollDetailTabFirst.js
+++ b/public/react/src/modules/courses/poll/PollDetailTabFirst.js
@@ -309,7 +309,7 @@ class PollDetailTabFirst extends Component{
width:120,
render:(operation,item,index)=>{
return(
- item.status == 1 ?
{data&&data.course_name} > 实训作业 diff --git a/public/react/src/modules/courses/statistics/Statistics.js b/public/react/src/modules/courses/statistics/Statistics.js index 883b2db50..589d8eb90 100644 --- a/public/react/src/modules/courses/statistics/Statistics.js +++ b/public/react/src/modules/courses/statistics/Statistics.js @@ -420,7 +420,7 @@ class Statistics extends Component{ { this.props.isAdmin()===true? // 这里是文件下载 不能替换路由 - this.derivefun(this.state.activeKey==="1"?`/courses/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出 + this.derivefun(this.state.activeKey==="1"?`/classrooms/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出 :"" } ; diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index 45310673f..822f7b8fe 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -193,32 +193,32 @@ class MessagSub extends Component { return; case 'JoinCourse' : // 课堂详情页 :id = - return window.open(`/courses/${item.belong_container_id}/teachers`) + return window.open(`/classrooms/${item.belong_container_id}/teachers`) case 'StudentJoinCourse': // 课堂详情页 :id = container_id if (item.tiding_type === 'Apply') { - return window.open(`/courses/${item.belong_container_id}/teachers`); + return window.open(`/classrooms/${item.belong_container_id}/teachers`); } if (item.tiding_type === 'System') { //教学案例详情 :id = container_id - return window.open(`/courses/${item.belong_container_id}/students`); + return window.open(`/classrooms/${item.belong_container_id}/students`); } case 'DealCourse': // 课堂详情页 :id = container_id - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) case 'TeacherJoinCourse': // 课堂详情页 :id = container_id - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) case 'Course' : // 课堂详情页 :id = container_id if (item.tiding_type === "Delete") { return; } - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) case 'ArchiveCourse' : // 课堂详情页 :id = container_id - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) case "Shixun" : return window.open(`/shixuns/${item.identifier}/challenges`) case "Subject" : @@ -234,33 +234,33 @@ class MessagSub extends Component { //学生作业页 homework = parent_container_id if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/question`) + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/question`) } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/question`) + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/question`) } if (item.homework_type === "practice") { //实训作业 - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`) } return ""; case "GraduationTopic" : // 毕业目标页 parent_container_id - return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) + return window.open(`/classrooms/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) case "StudentWorksScore" : //学生作业页 if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/question`) + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/question`) } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/question`) + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/question`) } if (item.homework_type === "practice") { //实训作业 - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`) } return ""; } @@ -314,109 +314,109 @@ class MessagSub extends Component { //记得跳评阅页面 default : // 课堂-试卷列表详情 :id = container_id - return window.open(`/courses/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`); + return window.open(`/classrooms/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`); } case 'StudentGraduationTopic' : //课堂-毕业选题详情 :id = parent_container_id - return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) + return window.open(`/classrooms/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) case 'DealStudentTopicSelect' : //课堂-毕业选题详情 :id = parent_container_id - return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) + return window.open(`/classrooms/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) case 'GraduationTask' : //课堂-毕业任务页 :id = container_id - return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`) + return window.open(`/classrooms/${item.belong_container_id}/graduation_tasks/${item.container_id}`) case "GraduationWork" : //课堂-毕业xx页 :id = container_id - return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`) + return window.open(`/classrooms/${item.belong_container_id}/graduation_tasks/${item.container_id}`) case "GraduationWorkScore" : // 课堂-毕业xx页 :id = parent_container_id - return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.parent_container_id}`) + return window.open(`/classrooms/${item.belong_container_id}/graduation_tasks/${item.parent_container_id}`) case "HomeworkCommon" : switch (item.parent_container_type) { case "AnonymousCommentFail" : // 课堂-作业列表 homework = container_id if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "practice") { //实训作业 - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } case "HomeworkPublish" : if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "practice") { //实训作业 - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } case "AnonymousAppeal" : if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "practice") { //实训作业 - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } default : // 课堂-作业列表 homework = container_id if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) } if (item.homework_type === "practice") { //实训作业 - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } } case "StudentWork" : //课堂-作业 :id = container_id if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/${item.container_id}/appraise`) + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/${item.container_id}/appraise`) } if (item.homework_type === "group") { //分组作业/courses/1208/group_homeworks/22373/1219130/appraise - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/${item.container_id}/appraise`) + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/${item.container_id}/appraise`) } if (item.homework_type === "practice") { //实训作业 - return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) + return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } case "StudentWorksScore" : //课堂-作业 :id = parent_container_id // if(item.homework_type==="normal"){ // //普通作业 - // return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) + // return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) // } // if(item.homework_type==="group"){ // //分组作业 - // return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) + // return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) // } // if(item.homework_type==="practice"){ // //实训作业 - // return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) + // return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) // } - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); case "StudentWorksScoresAppeal" : // if(item.homework_type==="normal"){ @@ -425,13 +425,13 @@ class MessagSub extends Component { // } // if(item.homework_type==="group"){ // //分组作业 - // return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) + // return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) // } // if(item.homework_type==="practice"){ // //实训作业 - // return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) + // return window.open(`/classrooms/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) // } - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); case "ChallengeWorkScore" : return ''; case "SendMessage" : @@ -488,30 +488,30 @@ class MessagSub extends Component { } return ''; case "PublicCourseStart": - return window.open(`/courses/${item.container_id}/informs`); + return window.open(`/classrooms/${item.container_id}/informs`); case "SubjectStartCourse": return window.open(`/paths/${item.container_id}`); case "ResubmitStudentWork": if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/${item.container_id}/appraise`); + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/${item.container_id}/appraise`); } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/${item.container_id}/appraise`); + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/${item.container_id}/appraise`); } case "AdjustScore": //belong_container_id course的id if (item.homework_type === "normal") { //普通作业 - return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}`); + return window.open(`/classrooms/${item.belong_container_id}/common_homeworks/${item.parent_container_id}`); } if (item.homework_type === "group") { //分组作业 - return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}`); + return window.open(`/classrooms/${item.belong_container_id}/group_homeworks/${item.parent_container_id}`); } case 'LiveLink': - return window.open(`/courses/${item.belong_container_id}/course_videos?open=live`); + return window.open(`/classrooms/${item.belong_container_id}/course_videos?open=live`); case 'Hack': if (item.extra && item.parent_container_type !== 'HackDelete') { return window.open(`/problems/${item.extra}/edit`);