fix buggetti

master
grgr 1 year ago
parent ac8d795ca1
commit 0a6da1d89e

Binary file not shown.

@ -104,19 +104,26 @@ def create():
# update category_name to refer to the newly added category
category_name = new_category
if topic_tag == 'New topic' and new_topic:
# if topic_tag == 'New topic' and new_topic:
# conn.execute('INSERT INTO topics (content) VALUES (?)',
# (new_topic,))
# conn.commit()
# topic_tag = new_topic
# cat_id = conn.execute('SELECT id FROM categories WHERE category_name = (?);',
# (category_name,)).fetchone()['id']
# topic_id = conn.execute('SELECT id FROM topics WHERE content = (?);',
# (topic_tag,)).fetchone()['id']
# conn.execute('INSERT INTO topic_cards (topic_id, card_id) VALUES (?,?)',
# (topic_id, cat_id))
if topic_tag =='New topic' and new_topic:
conn.execute('INSERT INTO topics (content) VALUES (?)',
(new_topic,))
(new_topic,))
conn.commit()
topic_tag = new_topic
cat_id = conn.execute('SELECT id FROM categories WHERE category_name = (?);',
(category_name,)).fetchone()['id']
topic_id = conn.execute('SELECT id FROM topics WHERE content = (?);',
(topic_tag,)).fetchone()['id']
conn.execute('INSERT INTO topic_cards (topic_id, card_id) VALUES (?,?)',
(topic_id, cat_id))
if not content:
flash('plz write a content!')
@ -127,11 +134,14 @@ def create():
conn.execute('INSERT INTO cards (content, category_id) VALUES (?,?)',
(content, cat_id))
conn.commit()
topic_id = conn.execute('SELECT id FROM topics WHERE content = (?);',
(topic_tag,)).fetchone()['id']
card_id = conn.execute('SELECT id FROM cards WHERE content = (?);',
(content,)).fetchone()['id']
conn.execute('INSERT INTO topic_cards (topic_id, card_id) VALUES (?,?)',
(topic_id, cat_id))
(topic_id, card_id))
conn.commit()
conn.close()

@ -68,3 +68,10 @@ https://www.digitalocean.com/community/tutorials/how-to-use-many-to-many-databas
ok, after a few tutorials I realized there are other ways of building this relational database with reading lists and notes and references, so I'm gonna move this log on a md file, and re do everything from scratch since it doesn't make sense as it is now. or maybe should I publish this log on the console log of the client?
It is handier if the code is distributed in more files, with a dedicated schema.sql file and an init_db.py file where i can hadle the construction of the database
this way of working reminds me of a tapestry, with threads being pulled from both the front and the back of the weaving frame
03/12/22
Ok. I'm doing everything from scratch again
reason: the database design is not ok for what I wanna do D:

Binary file not shown.
Loading…
Cancel
Save