-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue SB-11205 fix: adding ets fixes error correction from server ts #10
base: master
Are you sure you want to change the base?
Conversation
js/dist/index.js
Outdated
@@ -2187,6 +2187,16 @@ var Telemetry = (function() { | |||
} | |||
} | |||
|
|||
var calculateTsDifference = function (tsObj) { | |||
var tsDiff = 0; | |||
if (tsObj && tsObj.serverEts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indentation issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -385,7 +396,7 @@ var Telemetry = (function() { | |||
*/ | |||
instance.getEvent = function(eventId, data) { | |||
telemetryInstance.telemetryEnvelop.eid = eventId; | |||
telemetryInstance.telemetryEnvelop.ets = (new Date()).getTime(); | |||
telemetryInstance.telemetryEnvelop.ets = new Number(new Date().getTime()) + Telemetry.config.tsDiff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the cast to Number necessary?
spyOn(telemetryObj, 'initialize').and.callThrough(); | ||
module = 'undefined' | ||
console.log("Module", module) | ||
config.pdata = { "id": "in.ekstep", "ver": "1.0", "pid": "" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the reference to "in.ekstep" use "org.sunbird" instead
config.channel = 'in.ekstep.' | ||
config.timeStampData = {serverTime: new Date(),localTime: localTime} | ||
telemetryObj.initialize(config); | ||
expect(EkTelemetry.config.tsDiff).not.toEqual(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not enough assertions. Assert for the exact value by setting the server time to a fixed value as well. Also assert for the right event timestamp by firing an event.
https://project-sunbird.atlassian.net/browse/SB-11205