Update database.py
This commit is contained in:
+6
-2
@@ -171,9 +171,13 @@ def remove_article(n_id):
|
|||||||
for i in n_id:
|
for i in n_id:
|
||||||
itemid = i[0]
|
itemid = i[0]
|
||||||
|
|
||||||
# TODO if client has movie dont remove
|
c.execute("SELECT * FROM rent WHERE movieid = '" + str(itemid) + "' AND timeavaible > 0")
|
||||||
|
result = c.fetchall()
|
||||||
|
if result:
|
||||||
|
print("\n\tCan't remove article because there are user(s) renting it")
|
||||||
|
else:
|
||||||
c.execute("DELETE FROM movies WHERE itemid = '" + str(itemid) + "'")
|
c.execute("DELETE FROM movies WHERE itemid = '" + str(itemid) + "'")
|
||||||
print("\n\tMovie removed successfully")
|
print("\n\tArticle removed successfully")
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user