Skip to content

Commit

Permalink
refactor to be less nested
Browse files Browse the repository at this point in the history
Signed-off-by: Isaac Milarsky <[email protected]>
  • Loading branch information
IsaacMilarky committed Oct 23, 2023
1 parent 786ce74 commit 75f0fb0
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def facade_bulk_insert_commits(session,records):

facade_bulk_insert_commits(session,firsthalfRecords)
facade_bulk_insert_commits(session,secondhalfRecords)
elif len(records) == 1 and isinstance(e,DataError):
elif len(records) == 1 and isinstance(e,DataError) and "time zone displacement" in f"{e}":
commit_record = records[0]
#replace incomprehensible dates with epoch.
#2021-10-11 11:57:46 -0500
Expand All @@ -244,18 +244,14 @@ def facade_bulk_insert_commits(session,records):
#Check for improper utc timezone offset
#UTC timezone offset should be betwen -14:00 and +14:00

if "time zone displacement" in f"{e}":
commit_record['author_timestamp'] = placeholder_date
commit_record['committer_timestamp'] = placeholder_date

session.execute(
s.insert(Commit),
[commit_record],
)
session.commit()
else:
session.logger.error(f"Ran into issue when trying to insert commit: {commit_record} \n Error: {e}")
raise e
commit_record['author_timestamp'] = placeholder_date
commit_record['committer_timestamp'] = placeholder_date

session.execute(
s.insert(Commit),
[commit_record],
)
session.commit()
else:
raise e

0 comments on commit 75f0fb0

Please sign in to comment.