Skip to content

Commit

Permalink
Merge pull request #2554 from chaoss/fix-syntax-error
Browse files Browse the repository at this point in the history
Fix syntax error in facade changes
  • Loading branch information
IsaacMilarky authored Oct 24, 2023
2 parents 968aa0b + 75f0fb0 commit 80e0abb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def generate_commit_record(repos_id,commit,filename,
author_email = strip_extra_amp(author_email)
committer_email = strip_extra_amp(committer_email)

#replace incomprehensible dates with epoch.
#2021-10-11 11:57:46 -0500
placeholder_date = "1970-01-01 00:00:15 -0500"

#session.logger.info(f"Timestamp: {author_timestamp}")
commit_record = {
Expand Down
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)
else if 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 80e0abb

Please sign in to comment.