diff --git a/webiste/app/db_class/db.py b/webiste/app/db_class/db.py index ecd17619..8c759805 100644 --- a/webiste/app/db_class/db.py +++ b/webiste/app/db_class/db.py @@ -27,6 +27,7 @@ class Session_db(db.Model): config_module=db.Column(db.String) result=db.Column(db.String) nb_errors = db.Column(db.Integer, index=True) + query_date = db.Column(db.DateTime, index=True) def to_json(self): return diff --git a/webiste/app/home.py b/webiste/app/home.py index 73db3e73..312d4834 100644 --- a/webiste/app/home.py +++ b/webiste/app/home.py @@ -29,7 +29,12 @@ def query(sid): query_loc = s.query session=s if flag: - return render_template("query.html", query=query_loc, sid=sid, input_query=session.input_query, modules=json.loads(session.modules_list)) + return render_template("query.html", + query=query_loc, + sid=sid, + input_query=session.input_query, + modules=json.loads(session.modules_list), + query_date=session.query_date.strftime('%Y-%m-%d')) return render_template("404.html") diff --git a/webiste/app/home_core.py b/webiste/app/home_core.py index 75d0643f..cab24031 100644 --- a/webiste/app/home_core.py +++ b/webiste/app/home_core.py @@ -139,5 +139,11 @@ def get_history(): histories = History.query.all() for history in histories: session = Session_db.query.get(history.session_id) - histories_list.append({"uuid": session.uuid, "query": session.query_enter, "modules": json.loads(session.modules_list), "input": session.input_query}) + histories_list.append({ + "uuid": session.uuid, + "query": session.query_enter, + "modules": json.loads(session.modules_list), + "input": session.input_query, + "query_date": session.query_date.strftime('%Y-%m-%d') + }) return histories_list diff --git a/webiste/app/session.py b/webiste/app/session.py index 1b99e491..b1bee96c 100644 --- a/webiste/app/session.py +++ b/webiste/app/session.py @@ -1,3 +1,4 @@ +import datetime import json from queue import Queue from threading import Thread @@ -25,6 +26,7 @@ def __init__(self, request_json) -> None: self.modules_list = request_json["modules"] self.nb_errors = 0 self.config_module = self.config_module_setter(request_json) + self.query_date = datetime.datetime.now(tz=datetime.timezone.utc) def config_module_setter(self, request_json): @@ -128,7 +130,8 @@ def save_info(self): input_query=self.input_query, config_module=json.dumps(self.config_module), result=json.dumps(self.result), - nb_errors=self.nb_errors + nb_errors=self.nb_errors, + query_date=self.query_date ) db.session.add(s) db.session.commit() diff --git a/webiste/app/templates/history.html b/webiste/app/templates/history.html index 9fb19032..92b0cb0f 100644 --- a/webiste/app/templates/history.html +++ b/webiste/app/templates/history.html @@ -25,6 +25,12 @@