hide ungraded survey points
fixes CNVS-9746 test plan: * create an ungraded survey with questions that have points note: you must create the questions before you save the ungraded survey for the first time * navigate to the show page * points possible should be blank * navigate to the quizzes index * points possible for this survey should not show up Change-Id: Ic34d55640ba7a0c1972cf26ad080a8adfee7dd8b Reviewed-on: https://gerrit.instructure.com/62568 Reviewed-by: John Corrigan <jcorrigan@instructure.com> Tested-by: Jenkins QA-Review: Derek Hansen <dhansen@instructure.com> Product-Review: Jason Sparks <jsparks@instructure.com>
This commit is contained in:
parent
1413fb2d97
commit
5935a81e21
|
@ -65,10 +65,13 @@ define [
|
|||
initPointsCount: ->
|
||||
pts = @get 'points_possible'
|
||||
text = ''
|
||||
if pts && pts > 0
|
||||
if pts && pts > 0 && !@isUngradedSurvey()
|
||||
text = I18n.t('assignment_points_possible', 'pt', count: pts)
|
||||
@set 'possible_points_label', text
|
||||
|
||||
isUngradedSurvey: ->
|
||||
@get('quiz_type') == "survey"
|
||||
|
||||
initAllDates: ->
|
||||
if (allDates = @get('all_dates'))?
|
||||
@set 'all_dates', new DateGroupCollection(allDates)
|
||||
|
|
|
@ -672,4 +672,8 @@ module QuizzesHelper
|
|||
end
|
||||
end
|
||||
|
||||
def points_possible_display
|
||||
@quiz.quiz_type == "survey" ? "" : @quiz.points_possible
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<%= t(:points, "Points") %>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<span class="value"><%= @quiz.points_possible %></span>
|
||||
<span class="value"><%= points_possible_display %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -85,6 +85,10 @@ define [
|
|||
@quiz = new Quiz(points_possible: 2)
|
||||
equal @quiz.get('possible_points_label'), "2 pts"
|
||||
|
||||
test "#initialize points possible to null if ungraded survey", ->
|
||||
@quiz = new Quiz(points_possible: 5, quiz_type: "survey")
|
||||
equal @quiz.get('possible_points_label'), ""
|
||||
|
||||
# Publishing
|
||||
|
||||
test '#publish saves to the server', ->
|
||||
|
|
|
@ -88,5 +88,21 @@ describe "/quizzes/quizzes/show" do
|
|||
expect(response).not_to have_tag ".unpublished_quiz_warning"
|
||||
end
|
||||
|
||||
it "should hide points possible for ungraded surveys" do
|
||||
points = 5
|
||||
|
||||
course_with_teacher_logged_in(active_all: true)
|
||||
@quiz = @course.quizzes.create!(quiz_type: "survey", points_possible: points)
|
||||
|
||||
assigns[:quiz] = @quiz
|
||||
view_context
|
||||
render "quizzes/quizzes/show"
|
||||
|
||||
doc = Nokogiri::HTML(response)
|
||||
doc.css(".control-group .controls .value").each do |node|
|
||||
expect(node.content).not_to include("#{points}") if node.parent.parent.content.include? "Points"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue