Fix missed created_at and replace it with client_timestamp

fixes CNVS-26913

test plan
- Create a quiz and add a question of any type to the quiz.
- Open the quiz in safari as a student.
- Ensure that the quiz loads correctly

Change-Id: I31aecfd63f5753aaa0251377371a732b603a8481
Reviewed-on: https://gerrit.instructure.com/71164
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Tested-by: Jenkins
Product-Review: Davis McClellan <dmcclellan@instructure.com>
This commit is contained in:
Davis McClellan 2016-01-30 09:41:23 -07:00
parent e909760c4b
commit 73c26ec59c
2 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@ define (require) ->
# @internal Create an Event from the JSON version stored in localStorage.
@fromJSON: (descriptor) ->
event = new QuizEvent(descriptor.event_type, descriptor.event_data)
event.recordedAt = new Date(descriptor.created_at)
event.recordedAt = new Date(descriptor.client_timestamp)
event
constructor: (type, data) ->
@ -54,4 +54,4 @@ define (require) ->
}
toString: ->
JSON.stringify(this.toJSON())
JSON.stringify(this.toJSON())

View File

@ -18,7 +18,7 @@ define [
test 'QuizEvent.fromJSON', ->
descriptor = {
created_at: (new Date()).toJSON(),
client_timestamp: (new Date()).toJSON(),
event_type: 'some_type',
event_data: {
foo: 'bar'
@ -26,6 +26,7 @@ define [
}
event = QuizEvent.fromJSON(descriptor)
ok (event.recorded_at == descriptor.client_timestamp)
equal event.type, descriptor.event_type,
'it parses the type'
@ -34,4 +35,4 @@ define [
'it parses the custom data'
deepEqual event.recordedAt, new Date(descriptor.created_at),
'it parses the recording timestamp'
'it parses the recording timestamp'