Skip to content

Commit

Permalink
one more time...
Browse files Browse the repository at this point in the history
 	modified:   journalsmanager/tasks.py
  • Loading branch information
seasidesparrow committed May 13, 2024
1 parent bb6805f commit f23ccc2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions journalsmanager/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,18 +855,17 @@ def task_delete_masterid(masterid):
data['editid'] = editid
backup_rows.append(data)
delete_rows.append(masterid)
if dbname == 'refsource':
backup_rows = []

if backup_rows:
try:
with app.session_scope() as session:
for row in backup_rows:
data = dbhist()
for k,v in row.items():
setattr(data, k, v)
session.add(data)
session.commit()
if dbname != 'refsource':
for row in backup_rows:
data = dbhist()
for k,v in row.items():
setattr(data, k, v)
session.add(data)
session.commit()
for row in delete_rows:
session.query(db).filter(db.masterid==row).delete()
session.commit()
Expand Down

0 comments on commit f23ccc2

Please sign in to comment.