Modules page doesn't show duplicating/failed_to_duplicate assignments
Launching duplicating/failed_to_duplicate new quizzes assignments provides no value as the assignments do not yet exist, and is actually destructive as it will create a blank assignment on the new quizzes side with no connection to its parent assignment. closes QUIZ-10828 flag=none Test Plan: - Create a BP parent course with a new quizzes assignment. - ADD THE NQ ASSIGNMENT TO A MODULE. - Create a child course. - Ensure your live events are turned off and/or quiz lti is turned off. - In the canvas rails console run this: Setting.set("quizzes_next_timeout_minutes", "1") - Run a BPS. - Check the child course. 1. The Assignments/Quizzes list should have a spinner for the quiz. 2. The modules list should have no entries. - Wait 1 minute, then in the Canvas rails console run: Assignment.clean_up_duplicating_assignments - Check the child course. 1. The assignments/quizzes list should have an 'Oops!' entry for the quiz. 2. The modules list should have no entries. - Turn on quiz lti and your canvas live event streams. - Run another BPS. - Check the child course. 1. The assignments/quizzes list should have a valid entry for the quiz. 2. The modules list should have a valid entry for the quiz. Change-Id: I971173ebca77e9ecfb152677092bd7f48f789d2b Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/311411 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Product-Review: Marissa Pio Roda <marissa.pioroda@instructure.com> QA-Review: Weston Dransfield <wdransfield@instructure.com> Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
This commit is contained in:
parent
b3055bea55
commit
3fa8ec3567
|
@ -133,9 +133,14 @@ module ContextModulesHelper
|
|||
|
||||
def process_module_data(mod, is_student = false, current_user = nil, session = nil)
|
||||
# pre-calculated module view data can be added here
|
||||
items = mod.content_tags_visible_to(@current_user)
|
||||
items = items.reject do |item|
|
||||
item.content.respond_to?(:hide_on_modules_view?) && item.content.hide_on_modules_view?
|
||||
end
|
||||
|
||||
module_data = {
|
||||
published_status: mod.published? ? "published" : "unpublished",
|
||||
items: mod.content_tags_visible_to(@current_user)
|
||||
items: items
|
||||
}
|
||||
|
||||
if cyoe_enabled?(@context)
|
||||
|
|
|
@ -3919,6 +3919,10 @@ class Assignment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def hide_on_modules_view?
|
||||
["duplicating", "failed_to_duplicate"].include?(workflow_state)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def grading_type_requires_points?
|
||||
|
|
|
@ -242,6 +242,17 @@ describe ContextModulesHelper do
|
|||
expect(item_data[:show_cyoe_placeholder]).to eq false
|
||||
end
|
||||
end
|
||||
|
||||
it "does not return items that are hide_on_modules_view? == true" do
|
||||
course = course_factory(active_all: true)
|
||||
test_module = course.context_modules.create! name: "test module"
|
||||
hidden_assignment = course.assignments.create!(workflow_state: "failed_to_duplicate")
|
||||
test_module.add_item(type: "assignment", id: hidden_assignment.id)
|
||||
|
||||
module_data = process_module_data(test_module, true, @student, @session)
|
||||
|
||||
expect(module_data[:items]).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe "add_mastery_paths_to_cache_key" do
|
||||
|
|
|
@ -62,4 +62,30 @@ describe Assignment do
|
|||
expect(first_student_position).to eq(initial_student_first ? 1 : 2)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#hide_on_modules_view?" do
|
||||
before(:once) do
|
||||
@course = Course.create!
|
||||
end
|
||||
|
||||
it "returns true when the assignment is in the failed_to_duplicate state" do
|
||||
assignment = @course.assignments.create!(workflow_state: "failed_to_duplicate", **assignment_valid_attributes)
|
||||
expect(assignment.hide_on_modules_view?).to eq true
|
||||
end
|
||||
|
||||
it "returns true when the assignment is in the duplicating state" do
|
||||
assignment = @course.assignments.create!(workflow_state: "duplicating", **assignment_valid_attributes)
|
||||
expect(assignment.hide_on_modules_view?).to eq true
|
||||
end
|
||||
|
||||
it "returns false when the assignment is in the published state" do
|
||||
assignment = @course.assignments.create!(workflow_state: "published", **assignment_valid_attributes)
|
||||
expect(assignment.hide_on_modules_view?).to eq false
|
||||
end
|
||||
|
||||
it "returns false when the assignment is in the unpublished state" do
|
||||
assignment = @course.assignments.create!(workflow_state: "unpublished", **assignment_valid_attributes)
|
||||
expect(assignment.hide_on_modules_view?).to eq false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,6 +80,34 @@ describe "context_modules/index" do
|
|||
expect(page.css("#context_module_item_#{module_item.id}").length).to eq 0
|
||||
end
|
||||
|
||||
it "does not show failed_to_duplicate content_tags" do
|
||||
course_factory
|
||||
context_module = @course.context_modules.create!
|
||||
assignment = @course.assignments.create!(workflow_state: "failed_to_duplicate")
|
||||
module_item = context_module.add_item(type: "assignment", id: assignment.id)
|
||||
|
||||
view_context(@course, @user)
|
||||
assign(:modules, @course.context_modules.active)
|
||||
render "context_modules/index"
|
||||
expect(response).not_to be_nil
|
||||
page = Nokogiri("<document>" + response.body + "</document>")
|
||||
expect(page.css("#context_module_item_#{module_item.id}").length).to eq 0
|
||||
end
|
||||
|
||||
it "does not show duplicating content_tags" do
|
||||
course_factory
|
||||
context_module = @course.context_modules.create!
|
||||
assignment = @course.assignments.create!(workflow_state: "duplicating")
|
||||
module_item = context_module.add_item(type: "assignment", id: assignment.id)
|
||||
|
||||
view_context(@course, @user)
|
||||
assign(:modules, @course.context_modules.active)
|
||||
render "context_modules/index"
|
||||
expect(response).not_to be_nil
|
||||
page = Nokogiri("<document>" + response.body + "</document>")
|
||||
expect(page.css("#context_module_item_#{module_item.id}").length).to eq 0
|
||||
end
|
||||
|
||||
it "shows download course content if settings are enabled" do
|
||||
course_factory
|
||||
acct = @course.root_account
|
||||
|
|
Loading…
Reference in New Issue