Skip to content
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

20087 - Statement locking and notification #1650

Merged
merged 20 commits into from
Aug 1, 2024
Merged

Conversation

seeker25
Copy link
Collaborator

@seeker25 seeker25 commented Jul 30, 2024

Issue #:
bcgov/entity#20087

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-pay license (Apache 2.0).

@seeker25 seeker25 marked this pull request as ready for review August 1, 2024 18:44
@seeker25
Copy link
Collaborator Author

seeker25 commented Aug 1, 2024

Just taking this for a test drive now.

# Correct for daylight savings.
hours = target_datetime.astimezone(pytz.timezone('America/Vancouver')).utcoffset().total_seconds() / 60 / 60
target_date = target_datetime.replace(tzinfo=timezone.utc) + relativedelta(hours=-hours)
return target_date.replace(tzinfo=None)
Copy link
Collaborator Author

@seeker25 seeker25 Aug 1, 2024

Choose a reason for hiding this comment

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

If i didn't do this, I would see weird behavour, would sometimes remove the hours.. but in the model unit test the hours* persists. tzinfo=None seems to make it always show the hours

@@ -21,7 +21,7 @@
from .db import db


class NonSufficientFundsModel(BaseModel): # pylint: disable=too-many-instance-attributes
class NonSufficientFunds(BaseModel): # pylint: disable=too-many-instance-attributes
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

renamed to make this consistent

@@ -51,6 +51,11 @@ class NonSufficientFundsModel(BaseModel): # pylint: disable=too-many-instance-a
invoice_id = db.Column(db.Integer, ForeignKey('invoices.id'), nullable=False)
invoice_number = db.Column(db.String(50), nullable=False, index=True, comment='CFS Invoice number')

@classmethod
def find_by_invoice_id(cls, invoice_id: int):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

small helper function only works on NonSufficientFunds (no complex joins to other entity types, should be fine)

Copy link
Collaborator

@ochiu ochiu left a comment

Choose a reason for hiding this comment

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

Looks good

@seeker25 seeker25 changed the title 20087 - Statement locking and notification - Minor tweaks based on testing 20087 - Statement locking and notification Aug 1, 2024
@seeker25 seeker25 merged commit 012af27 into bcgov:main Aug 1, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants