Skip to content

Commit

Permalink
dont get user if its already there (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Jun 3, 2024
1 parent 9649e11 commit ca9e0bf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pvsite_datamodel/write/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ def save_api_call_to_db(url, session, user=None):
url = str(url)
if user is None:
email = "unknown"
else:
email = user.email
user = get_user_by_db(session=session, email=email)

email = user.email

# get user from db
user = get_user_by_db(session=session, email=email)
# make api call
logger.info(f"Saving api call ({url=}) to database for user {email}")
api_request = APIRequestSQL(url=url, user=user)
Expand Down

0 comments on commit ca9e0bf

Please sign in to comment.