Skip to content

Commit

Permalink
on server entry time is 'x' on the client it's 'date'
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Jul 6, 2015
1 parent 4d2263a commit 3f41d1d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function init ( ) {

sbx.lastEntry = function lastEntry (entries) {
return _.findLast(entries, function notInTheFuture (entry) {
return entry.x <= sbx.time;
return entryToTime(entry) <= sbx.time;
});
};

Expand All @@ -129,10 +129,14 @@ function init ( ) {
};

sbx.lastSGVMills = function lastSGVMills ( ) {
var last = sbx.lastSGVEntry();
return (last && last.x) || (last && last.date && (new Date(last.date)).getTime()) || 0;
return entryToTime(sbx.lastSGVEntry());
};

function entryToTime(entry) {
//FIXME: field mismatch between server and client :(
return (entry && entry.x) || (entry && entry.date && (new Date(entry.date)).getTime()) || 0;
}

sbx.lastScaledSGV = function lastScaledSVG ( ) {
return sbx.scaleBg(sbx.lastSGV());
};
Expand Down

0 comments on commit 3f41d1d

Please sign in to comment.