Skip to content

Commit

Permalink
add if to avoid overwriting
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinaProsche committed Nov 14, 2023
1 parent 1dc9a75 commit 24f8d2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,10 @@ def get_zip():
original_name = db_methods.get_check(check['_id']).filename #get a filename from every check
if db_file is not None:
final_name = original_name if (original_name and original_names) else db_file.filename
with open(f"{dirpath.name}/{final_name}", 'wb') as os_file:
os_file.write(db_file.read())
# to avoid overwriting files with one name and different content: now we save only last version of pres (from last check)
if not os.path.exists(f'{dirpath.name}/{final_name}'):
with open(f"{dirpath.name}/{final_name}", 'wb') as os_file:
os_file.write(db_file.read())

# add csv
response = get_stats()
Expand Down

0 comments on commit 24f8d2c

Please sign in to comment.