Skip to content
This repository was archived by the owner on Mar 10, 2024. It is now read-only.

Commit fd2fbe4

Browse files
author
bhasher
committed
Initial code bugfix
1 parent 49d18cf commit fd2fbe4

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/db/db.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
random.seed()
1313

1414
base_code = json.dumps([
15-
[f"{utils.uuid(random.random(), 10)}", "def main(text: str) -> None:"],
16-
[f"{utils.uuid(random.random(), 10)}", " print(text)"],
17-
[f"{utils.uuid(random.random(), 10)}", ""],
18-
[f"{utils.uuid(random.random(), 10)}", "if __name__ == \'__main__\':"],
19-
[f"{utils.uuid(random.random(), 10)}", " main(\'Hello World !\')"]
15+
{'uuid': f'{utils.uuid(random.random(), 10)}', 'content': 'def main(text: str) -> None:'},
16+
{'uuid': f"{utils.uuid(random.random(), 10)}", 'content': ' print(text)'},
17+
{'uuid': f"{utils.uuid(random.random(), 10)}", 'content': ''},
18+
{'uuid': f"{utils.uuid(random.random(), 10)}", 'content': 'if __name__ == \'__main__\':'},
19+
{'uuid': f"{utils.uuid(random.random(), 10)}", 'content': ' main(\'Hello World !\')'}
2020
])
2121
datetime_format = '%Y-%m-%d %H:%M:%S'
2222

@@ -34,16 +34,14 @@ def __init__(self, host, username, password, database, port):
3434
port=port
3535
)
3636
self.cursor = self.conn.cursor()
37-
38-
37+
3938
def fetch_as_dict(self, query, args):
4039
c = self.conn.cursor(dictionary=True)
4140
c.execute(query, args)
4241
return c.fetchone()
4342

4443
def execute(self, query, args):
4544
self.cursor.execute(query, args)
46-
4745

4846
def get_document(self, doc_id):
4947
"""Get doc in the databse with id specified
@@ -57,7 +55,6 @@ def get_document(self, doc_id):
5755
query = queries['get_document'][self.get_db_mode()]
5856
return self.fetch_as_dict(query, (doc_id,))
5957

60-
6158
def update_document(self, doc_id, text_content):
6259
"""Update the document in the db with the id specified
6360
@@ -69,7 +66,6 @@ def update_document(self, doc_id, text_content):
6966
self.execute(query, (text_content, time.strftime(datetime_format), doc_id))
7067
self.conn.commit()
7168

72-
7369
def create_document(self):
7470
"""Create the document with id specified
7571
@@ -88,15 +84,13 @@ def create_document(self):
8884
self.conn.commit()
8985
return doc_id
9086

91-
9287
def delete_old_document(self, days):
9388
"""Delete document according to days and their last_viewed_date
9489
"""
9590
limit_date = (datetime.datetime.today() - datetime.timedelta(days=days)).strftime(datetime_format)
9691
query = queries['delete_old_document'][self.get_db_mode()]
9792
self.execute(query, (limit_date,))
9893

99-
10094
@classmethod
10195
def get_db_mode(cls):
10296
return cls.DB_MODE

src/static/js/editor/editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class Editor{
173173
let div = document.createElement("div");
174174
div.setAttribute("uuid", uuid);
175175
div.innerHTML = content + '<br>';
176-
new PrismCustom(div, 'python').apply();
176+
// new PrismCustom(div, 'python').apply();
177177
element.parentNode.insertBefore(div, element.nextSibling);
178178
}
179179

0 commit comments

Comments
 (0)