use null dates if not specified in all overrides
- matches logic in assignment_override_applicator.rb closes QO-387 Test plan: - create quiz with overrides - Everyone and section overrides with lock_at in the past - individual student override with lock_at not specified - view quizzes index page as student with override above - verify that quiz does not say "Closed" Change-Id: Ie70acee7429e75bfa7d1b89017d9be70225a8111 Reviewed-on: https://gerrit.instructure.com/169876 Tested-by: Jenkins Reviewed-by: Keith Garner <kgarner@instructure.com> Reviewed-by: Jacob Burroughs <jburroughs@instructure.com> QA-Review: Jacob Burroughs <jburroughs@instructure.com> Product-Review: Kevin Dougherty III <jdougherty@instructure.com>
This commit is contained in:
parent
fc2e6fae2d
commit
6cc74aa604
|
@ -44,11 +44,15 @@ define [
|
|||
quiz.set('loadingOverrides', false)
|
||||
|
||||
_chooseLatest: (dates, type) ->
|
||||
if _.any(dates, (d) -> _.isNull(d[type]) || _.isUndefined(d[type]))
|
||||
return null
|
||||
sortedDates = @_sortedDatesOfType(dates, type)
|
||||
if _.any(sortedDates)
|
||||
_.last(sortedDates)
|
||||
|
||||
_chooseEarliest: (dates, type) ->
|
||||
if _.any(dates, (d) -> _.isNull(d[type]) || _.isUndefined(d[type]))
|
||||
return null
|
||||
sortedDates = @_sortedDatesOfType(dates, type)
|
||||
if _.any(sortedDates)
|
||||
_.first(sortedDates)
|
||||
|
|
|
@ -41,9 +41,15 @@ test('can select the earliest date from a group', function() {
|
|||
equal(this.loader._chooseEarliest(this.dates, 'unlock_at'), this.earliestDate)
|
||||
})
|
||||
|
||||
test('ignores null dates and handles empty arrays', function() {
|
||||
test('handles null dates and handles empty arrays', function() {
|
||||
let dates = [{}, {}]
|
||||
equal(this.loader._chooseLatest(dates, 'due_at'), null)
|
||||
dates = []
|
||||
equal(this.loader._chooseLatest(dates, 'due_at'), null)
|
||||
})
|
||||
|
||||
test('returns null if any argument is null', function() {
|
||||
const dates = [...this.dates, {}]
|
||||
equal(this.loader._chooseLatest(dates, 'due_at'), null)
|
||||
equal(this.loader._chooseEarliest(dates, 'due_at'), null)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue