showing sis id for everyone, deleting courses emptied due to crosslisting
Change-Id: Ic72b72877dcc5ea15e539545945f01a242c6c47b Reviewed-on: https://gerrit.instructure.com/3207 Reviewed-by: Zach Wily <zach@instructure.com> Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
parent
a42a6e3b7c
commit
0edbecd027
|
@ -117,10 +117,21 @@ class CourseSection < ActiveRecord::Base
|
|||
self.save!
|
||||
end
|
||||
self.move_to_course(course)
|
||||
if (self.nonxlist_course.course_sections.active.count == 0 ||
|
||||
(self.nonxlist_course.course_sections.active.count == 1 &&
|
||||
self.nonxlist_course.course_sections.active.first.enrollments.count == 0)) &&
|
||||
self.nonxlist_course.workflow_state == "created"
|
||||
self.nonxlist_course.workflow_state = "deleted"
|
||||
self.nonxlist_course.save!
|
||||
end
|
||||
end
|
||||
|
||||
def uncrosslist
|
||||
return unless self.nonxlist_course
|
||||
if self.nonxlist_course.workflow_state == "deleted"
|
||||
self.nonxlist_course.workflow_state = "created"
|
||||
self.nonxlist_course.save!
|
||||
end
|
||||
self.move_to_course(self.nonxlist_course)
|
||||
self.nonxlist_course = nil
|
||||
self.account = nil
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<% if course.course_code != course.name %>
|
||||
<span style="padding-right: 30px;"><%= course.course_code %></span>
|
||||
<% end %>
|
||||
<% if current_user_is_site_admin? && course.respond_to?(:sis_source_id) && course.sis_source_id %>
|
||||
<% if course.respond_to?(:sis_source_id) && course.sis_source_id %>
|
||||
SIS ID: <%= course.sis_source_id %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -135,12 +135,12 @@
|
|||
</span>
|
||||
</td>
|
||||
<% end %>
|
||||
<% if @context.sis_source_id %>
|
||||
</tr><tr>
|
||||
<td><%= f.label :sis_source_id, "SIS ID:" %></td>
|
||||
<td><%= @context.sis_source_id %></td>
|
||||
<% end %>
|
||||
<% if current_user_is_site_admin? %>
|
||||
<% if @context.sis_source_id %>
|
||||
</tr><tr>
|
||||
<td><%= f.label :sis_source_id, "SIS ID:" %></td>
|
||||
<td><%= @context.sis_source_id %></td>
|
||||
<% end %>
|
||||
</tr><tr>
|
||||
<td><%= f.label :root_account_id, "Root Account:" %></td>
|
||||
<td><%= @context.root_account.name %></td>
|
||||
|
@ -326,7 +326,7 @@
|
|||
</a>
|
||||
<span class="users_count">
|
||||
(
|
||||
<%= pluralize(section.enrollments.count, "User") %><% if current_user_is_site_admin? && section && section.sis_source_id %>,
|
||||
<%= pluralize(section.enrollments.count, "User") %><% if section && section.sis_source_id %>,
|
||||
SIS ID: <%= section.sis_source_id %>
|
||||
<% end %>
|
||||
)
|
||||
|
|
|
@ -120,7 +120,7 @@ h3 .tally {
|
|||
<div>
|
||||
<%= pluralize((@current_enrollments + @completed_enrollments).length, 'Enrollment') %>
|
||||
</div>
|
||||
<% if current_user_is_site_admin? && @section && @section.sis_source_id %>
|
||||
<% if @section && @section.sis_source_id %>
|
||||
<div>SIS ID: <%= @section.sis_source_id %></div>
|
||||
<% end %>
|
||||
<% if @section.start_at || @section.end_at %>
|
||||
|
@ -174,4 +174,4 @@ $(document).ready(function() {
|
|||
$(".datetime_field").datetime_field();
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -96,13 +96,22 @@ describe CourseSection, "moving to new course" do
|
|||
course1 = account1.courses.create!
|
||||
course2 = account2.courses.create!
|
||||
course3 = account3.courses.create!
|
||||
course2.assert_section
|
||||
course3.assert_section
|
||||
cs = course1.course_sections.create!
|
||||
u = User.create!
|
||||
u.register!
|
||||
e = course2.enroll_user(u, 'StudentEnrollment')
|
||||
e.workflow_state = 'active'
|
||||
e.save!
|
||||
e = course1.enroll_user(u, 'StudentEnrollment', :section => cs)
|
||||
e.workflow_state = 'active'
|
||||
e.save!
|
||||
course1.reload
|
||||
course2.reload
|
||||
course3.workflow_state = 'active'
|
||||
course3.save
|
||||
e.reload
|
||||
|
||||
course1.course_sections.find_by_id(cs.id).should_not be_nil
|
||||
course2.course_sections.find_by_id(cs.id).should be_nil
|
||||
|
@ -111,6 +120,9 @@ describe CourseSection, "moving to new course" do
|
|||
cs.nonxlist_course.should be_nil
|
||||
e.root_account.should eql(account1)
|
||||
cs.crosslisted?.should be_false
|
||||
course1.workflow_state.should == 'created'
|
||||
course2.workflow_state.should == 'created'
|
||||
course3.workflow_state.should == 'created'
|
||||
|
||||
cs.crosslist_to_course(course2)
|
||||
course1.reload
|
||||
|
@ -125,6 +137,9 @@ describe CourseSection, "moving to new course" do
|
|||
cs.nonxlist_course.should eql(course1)
|
||||
e.root_account.should eql(account2)
|
||||
cs.crosslisted?.should be_true
|
||||
course1.workflow_state.should == 'deleted'
|
||||
course2.workflow_state.should == 'created'
|
||||
course3.workflow_state.should == 'created'
|
||||
|
||||
cs.crosslist_to_course(course3)
|
||||
course1.reload
|
||||
|
@ -140,6 +155,9 @@ describe CourseSection, "moving to new course" do
|
|||
cs.nonxlist_course.should eql(course1)
|
||||
e.root_account.should eql(account3)
|
||||
cs.crosslisted?.should be_true
|
||||
course1.workflow_state.should == 'deleted'
|
||||
course2.workflow_state.should == 'created'
|
||||
course3.workflow_state.should == 'created'
|
||||
|
||||
cs.uncrosslist
|
||||
course1.reload
|
||||
|
@ -155,6 +173,9 @@ describe CourseSection, "moving to new course" do
|
|||
cs.nonxlist_course.should be_nil
|
||||
e.root_account.should eql(account1)
|
||||
cs.crosslisted?.should be_false
|
||||
course1.workflow_state.should == 'created'
|
||||
course2.workflow_state.should == 'created'
|
||||
course3.workflow_state.should == 'created'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue