diff --git a/database.py b/database.py
index c004598..e06e985 100644
--- a/database.py
+++ b/database.py
@@ -136,7 +136,11 @@ def insert_quest_post(quest_id, post, timestamp):
"""
_DB.execute(
"INSERT INTO `quest_data` (`quest_id`, `post`, `timestamp`) " \
- "VALUES (%s, %s, %s)", (quest_id, post, timestamp))
+ + "VALUES (%s, %s, %s)", (quest_id, post, timestamp))
+ post_id = _DB.execute(
+ "SELECT `post_id` FROM `quest_data` WHERE `quest_id` = %s " \
+ + "ORDER BY `post_id` DESC", (quest_id,)).fetchone()[0]
+ return post_id
def get_quest_meta(quest_id=None, ident_title=None):
diff --git a/events.py b/events.py
index 3ebba10..6d5950a 100644
--- a/events.py
+++ b/events.py
@@ -69,7 +69,9 @@ def new_post(data):
post = post.replace("\n", "
")
post = tools.handle_img(post)
data["post"] = [post]
- db.insert_quest_post(room, post, int(time.time()))
+ data["date"] = int(time.time())
+ post_id = db.insert_quest_post(room, post, data["date"])
+ data["post_id"] = post_id
emit("new_post", data, room=room)
@@ -96,8 +98,8 @@ def update_post(data):
emit("update_post", data, room=room)
-@socketio.on('dice_post')
-def dice_post(data):
+@socketio.on("dice_post")
+def dice_(data):
"""
Called when the QM posts a new dice call.
"""
@@ -108,4 +110,9 @@ def dice_post(data):
return
if session.get("user_id") != res[3]:
return
+
+ date = int(time.time())
+ data["date"] = date
+ data["post_id"] = 0
+
emit("dice_post", data, room=room)
diff --git a/templates/quest.html b/templates/quest.html
index 05133a7..05b8dea 100644
--- a/templates/quest.html
+++ b/templates/quest.html
@@ -15,13 +15,9 @@
socket.emit('joined', {room: {{ room_id }}});
});
socket.on('message', function(data) {
- let date = new Date(data.date * 1000);
- let date_str = date.getFullYear() + '-' + padToTwo(date.getMonth()+1) + '-' + padToTwo(date.getDate()) + ' ';
- date_str += padToTwo(date.getHours()) + ':' + padToTwo(date.getMinutes()) + ':' + padToTwo(date.getSeconds());
-
- let msg_str = '