Skip to content

[FIX] - catch missing orgbook entity and improve logging #3301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Nov 13, 2024

Conversation

Jsyro
Copy link
Collaborator

@Jsyro Jsyro commented Nov 8, 2024

No description provided.

@Jsyro Jsyro added 👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback. 💊 Fix Fixes something that isn't working :) labels Nov 8, 2024
Copy link
Contributor

@matbusby matbusby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

matbusby-fw
matbusby-fw previously approved these changes Nov 8, 2024
return datetime(date.year, date.month, date.day, 0, 0, 0, tzinfo=ZoneInfo("UTC")).isoformat()
def convert_date_to_iso_datetime(datetime: datetime) -> str:
return datetime(
datetime.year, datetime.month, datetime.day, 0, 0, 0, tzinfo=ZoneInfo("UTC")).isoformat()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to check, just because we have a million issues with UTC times- this converts the datetime to UTC, not tells it that the timezone it has is UTC, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datetime objects are natively timezone-unaware.

the python language is deprecating some of these methods in favour or producting timezone-aware datetime objects

well formed VCDM credentials required timezone codes, i could just append T00:00:00 to the string, but this is a more pythonic way to do that and is better understood by future devs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What that means is existing datetime objects based on UTC don't know they are based on UTC, they are date+time with no timezone information. it's up to the code to know that it's based on UTC, or maybe postgres is automatically adding UTC information?

it's probably something that should become it's own task. to update the python to start using the new timezone-aware methods and classes, update the validators to require timezone-aware objects (or add it), then update remaining datetime values to have timezone information.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Sounds good. The db does automatically save it as UTC. I appreciate the documentation!

@Jsyro
Copy link
Collaborator Author

Jsyro commented Nov 8, 2024

This line scares me....

@taraepp
Copy link
Collaborator

taraepp commented Nov 8, 2024

This line scares me....

clicks git blame
#1634 😂
It was you!

On the bright side: you've learned something in the last 3 years.

@Jsyro
Copy link
Collaborator Author

Jsyro commented Nov 8, 2024

This line scares me....

clicks git blame #1634 😂 It was you!

On the bright side: you've learned something in the last 3 years.

that's not funny at all.

~~it implies that dates and datetimes are both being used in the code, but the original intention was to only ever store datetime objects. ~~
^This is wholly incorrect apparently, need to do more digging.

this one hurts, and on a friday no less.

pmt_appt_start_date = pmt_appt.start_date.date()
else:
print(type(pmt_appt.start_date))
print("WHAT?")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂
Miiiiiight want something else for an error log message. A little more context for the rest of us.

Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_core-api'

Failed conditions
78.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Collaborator

@simensma-fresh simensma-fresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for cleaning up those date <-> datetime inconsistencies 🙌

@Jsyro Jsyro merged commit 54aa36d into develop Nov 13, 2024
10 of 11 checks passed
@Jsyro Jsyro deleted the feature/issue-to-orgbook-w-publisher branch November 13, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💊 Fix Fixes something that isn't working :) 👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants