Skip to content

Commit e070988

Browse files
committed
fix duplicate file read
1 parent 0770e2a commit e070988

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/webapp/gcsdbutils.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,13 @@ def update_db_from_bucket(inst_id: str, session, storage_control):
6969
all_files = []
7070
for d in dir_prefix:
7171
all_files = all_files + storage_control.list_blobs_in_folder(
72-
get_external_bucket_name(inst_id), dir_prefix
72+
get_external_bucket_name(inst_id), d
7373
)
74-
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1")
75-
print(all_files)
7674
new_files_to_add_to_database = []
7775
for f in all_files:
7876
# We only handle png and csv outputs.
7977
if not f.endswith(".png") and not f.endswith(".csv"):
8078
continue
81-
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2")
82-
print(f)
8379
file_approved = is_file_approved(f)
8480
# Check if that file already exists in the table, otherwise add it.
8581
query_result = session.execute(
@@ -91,8 +87,6 @@ def update_db_from_bucket(inst_id: str, session, storage_control):
9187
)
9288
).all()
9389
if len(query_result) == 0:
94-
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3")
95-
print(f)
9690
new_files_to_add_to_database.append(
9791
FileTable(
9892
name=f,
@@ -119,8 +113,6 @@ def update_db_from_bucket(inst_id: str, session, storage_control):
119113
session.execute(query)
120114
elif len(query_result) == 1:
121115
# This file already exists, check if its status has changed.
122-
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx4")
123-
print(f)
124116
if query_result[0][0].valid != file_approved:
125117
# Technically you could make an approved file unapproved.
126118
query = (
@@ -137,6 +129,4 @@ def update_db_from_bucket(inst_id: str, session, storage_control):
137129
else:
138130
raise ValueError("Attempted creation of file with duplicate name.")
139131
for elem in new_files_to_add_to_database:
140-
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5")
141-
print(elem.name)
142132
session.add(elem)

0 commit comments

Comments
 (0)