log actual timestamps as well

so we can see if they are anything but null or a number
This commit is contained in:
Bruno Windels 2020-08-27 10:48:12 +02:00
parent 4b682ad930
commit 9e891c3442

View file

@ -59,7 +59,7 @@ export class RoomTileViewModel extends ViewModel {
let buf = ""; let buf = "";
function log(...args) { function log(...args) {
buf = buf + args.join(" ") + "\n"; buf = buf + args.map(a => a+"").join(" ") + "\n";
} }
function logResult(result) { function logResult(result) {
if (result === 0) { if (result === 0) {
@ -86,7 +86,7 @@ export class RoomTileViewModel extends ViewModel {
const theirTimestampValid = Number.isSafeInteger(theirTimestamp); const theirTimestampValid = Number.isSafeInteger(theirTimestamp);
// if either does not have a timestamp, put the one with a timestamp first // if either does not have a timestamp, put the one with a timestamp first
if (myTimestampValid !== theirTimestampValid) { if (myTimestampValid !== theirTimestampValid) {
log("checking if either does not have lastMessageTimestamp ..."); log("checking if either does not have lastMessageTimestamp ...", myTimestamp, theirTimestamp);
if (theirTimestamp === null) { if (theirTimestamp === null) {
return logResult(-1); return logResult(-1);
} }
@ -94,7 +94,7 @@ export class RoomTileViewModel extends ViewModel {
} }
const timeDiff = theirTimestamp - myTimestamp; const timeDiff = theirTimestamp - myTimestamp;
if (timeDiff === 0 || !theirTimestampValid || !myTimestampValid) { if (timeDiff === 0 || !theirTimestampValid || !myTimestampValid) {
log("checking name ..."); log("checking name ...", myTimestamp, theirTimestamp);
// sort alphabetically // sort alphabetically
const nameCmp = this.name.localeCompare(other.name); const nameCmp = this.name.localeCompare(other.name);
if (nameCmp === 0) { if (nameCmp === 0) {