hide unpublished assignments in gradebook
test plan: - Make sure you have draft state enabled. - Create an assignment. - In both Gradebook 1 and Gradebook 2: - Publish the assignment. It should be visible in the gradebook. - Unpublish the assignment. It should not be visible in the gradebook. fixes CNVS-7748 Change-Id: I027db3654d2e41518366fff7e810051a7450a098 Reviewed-on: https://gerrit.instructure.com/23848 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cameron Matheson <cameron@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: Myller de Araujo <myller@instructure.com> Product-Review: Stanley Stuart <stanley@instructure.com>
This commit is contained in:
parent
00d5829fdc
commit
0fbc88bd8f
|
@ -115,6 +115,8 @@ define [
|
|||
for group in assignmentGroups
|
||||
htmlEscape(group)
|
||||
@assignmentGroups[group.id] = group
|
||||
if ENV.GRADEBOOK_OPTIONS.draft_state_enabled
|
||||
group.assignments = _.select group.assignments, (a) -> a.published
|
||||
for assignment in group.assignments
|
||||
htmlEscape(assignment)
|
||||
assignment.assignment_group = group
|
||||
|
|
|
@ -26,6 +26,7 @@ class Gradebook2Controller < ApplicationController
|
|||
:course_is_concluded => @context.completed?,
|
||||
:gradebook_is_editable => @gradebook_is_editable,
|
||||
:speed_grader_enabled => @context.allows_speed_grader?,
|
||||
:draft_state_enabled => @context.root_account.enable_draft?
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -157,6 +157,9 @@ class GradebooksController < ApplicationController
|
|||
newest = Time.parse("Jan 1 2010")
|
||||
@just_assignments = @just_assignments.sort_by{|a| [a.due_at || newest, @groups_order[a.assignment_group_id] || 0, a.position || 0] }
|
||||
@assignments = @just_assignments.dup + groups_as_assignments(@groups)
|
||||
if @context.root_account.enable_draft?
|
||||
@assignments = @assignments.select(&:published?)
|
||||
end
|
||||
@gradebook_upload = @context.build_gradebook_upload
|
||||
@submissions = @context.submissions
|
||||
@new_submissions = @submissions
|
||||
|
|
|
@ -23,10 +23,23 @@ describe "gradebook2" do
|
|||
DEFAULT_PASSWORD = "qwerty"
|
||||
|
||||
context "as a teacher" do
|
||||
before (:each) do
|
||||
before(:each) do
|
||||
data_setup
|
||||
end
|
||||
|
||||
it "hides unpublished/shows published assignments" do
|
||||
@course.root_account.enable_draft!
|
||||
@first_assignment.unpublish
|
||||
get "/courses/#{@course.id}/gradebook2"
|
||||
wait_for_ajaximations
|
||||
f('#gradebook_grid .slick-header').should_not include_text(@first_assignment.title)
|
||||
|
||||
@first_assignment.publish
|
||||
get "/courses/#{@course.id}/gradebook2"
|
||||
wait_for_ajaximations
|
||||
f('#gradebook_grid .slick-header').should include_text(@first_assignment.title)
|
||||
end
|
||||
|
||||
it "should not show 'not-graded' assignments" do
|
||||
get "/courses/#{@course.id}/gradebook2"
|
||||
wait_for_ajaximations
|
||||
|
|
|
@ -43,6 +43,19 @@ describe "gradebook1" do
|
|||
)
|
||||
end
|
||||
|
||||
it "hides/shows assignments based on their draft state" do
|
||||
@course.root_account.enable_draft!
|
||||
@assignment.unpublish
|
||||
get "/courses/#{@course.id}/gradebook"
|
||||
wait_for_ajaximations
|
||||
f('body').text.should_not match @assignment.title
|
||||
|
||||
@assignment.publish
|
||||
get "/courses/#{@course.id}/gradebook"
|
||||
wait_for_ajaximations
|
||||
f('body').text.should match @assignment.title
|
||||
end
|
||||
|
||||
def switch_to_section(section_name="All")
|
||||
f("#gradebook_options").click
|
||||
wait_for_ajaximations
|
||||
|
|
Loading…
Reference in New Issue