修复先删除课程下的某班级,再删除该课程报错
This commit is contained in:
parent
67bdea314a
commit
6ab2c15504
|
@ -381,6 +381,7 @@ class StudentWorkController < ApplicationController
|
|||
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
|
||||
@show_all = false
|
||||
|
||||
# 0表示没有分组的学生,-1表示所有分组的学生
|
||||
if @group
|
||||
if @group == "0"
|
||||
none_group_students = @course.members.select{ |member| member.course_group_id == 0 }
|
||||
|
|
|
@ -88,7 +88,7 @@ class SyllabusesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
if @syllabus && @syllabus.courses.empty?
|
||||
if @syllabus && @syllabus.courses.not_deleted.empty?
|
||||
@syllabus.destroy
|
||||
redirect_to user_courselist_user_path(User.current.id)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<br>
|
||||
<div style='width:470px;text-align:center;font-family: "微软雅黑","宋体"' class="f14">
|
||||
<% if @syllabus.courses.empty? || @syllabus.courses.not_deleted.empty? %>
|
||||
<% if @syllabus.courses.not_deleted.empty? %>
|
||||
确认删除该课程吗?
|
||||
<% else %>
|
||||
该课程下已经存在班级,不能删除。
|
||||
|
@ -8,7 +8,7 @@
|
|||
</div>
|
||||
</br>
|
||||
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
|
||||
<% if @syllabus.courses.empty?|| @syllabus.courses.not_deleted.empty? %>
|
||||
<% if @syllabus.courses.not_deleted.empty? %>
|
||||
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
|
||||
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>关闭</a>
|
||||
<% else %>
|
||||
|
|
Loading…
Reference in New Issue