fix pychat message reordering · open-lambda/open-lambda@207bb84 · GitHub
Skip to content

Commit 207bb84

Browse files
committed
fix pychat message reordering
1 parent 17f941e commit 207bb84

3 files changed

Lines changed: 21 additions & 7 deletions

File tree

applications/pychat/chat.py

Lines changed: 11 additions & 1 deletion

applications/pychat/static/main.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ function updates(ts) {
3030
html_error = data.error.replace(/\n/g, '<br/>');
3131
$("#comments").html("Error: <br/><br/>" + html_error + "<br/><br/>Consider refreshing.")
3232
} else {
33-
//$("#comments").html(data.result.msg);
34-
$("#comments").append(data.result.msg + "<br/>");
35-
updates(data.result.ts);
33+
var ts = 0;
34+
for (var i = 0, len = data.result.length; i < len; i++) {
35+
row = data.result[i];
36+
$("#comments").append(row.msg + "<br/>");
37+
if (row.ts > ts) {
38+
ts = row.ts;
39+
}
40+
}
41+
updates(ts);
3642
}
3743
});
3844
}

util/setup.py

Lines changed: 1 addition & 3 deletions

0 commit comments

Comments
 (0)