-
Notifications
You must be signed in to change notification settings - Fork 75
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
25328 - Support Update and Save NoW Draft for Bootstrap Filing #3183
25328 - Support Update and Save NoW Draft for Bootstrap Filing #3183
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Megan! LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation works.
Just thoughts, the method can be optimized a bit to reduce the amount of 'if statements' and use more sqlAlchemy features.
My idea is:
def get_temp_reg_filing(temp_reg_id: str, filing_id: str = None):
"""Return a filing by the temp id and filing id (if applicable)."""
if not filing_id:
return db.session.query(Filing).filter(Filing.temp_reg == temp_reg_id).one_or_none()
return (
db.session.query(Filing).filter(
db.or_(
db.and_(
Filing.id == filing_id,
Filing.temp_reg == temp_reg_id
),
db.and_( # special case for NoW
Filing.id == filing_id,
Filing._filing_type == 'noticeOfWithdrawal',
Filing.withdrawn_filing_id == db.session.query(Filing.id)
.filter(Filing.temp_reg == temp_reg_id)
.scalar_subquery()
)
)
).one_or_none())
Quality Gate passedIssues Measures |
Issue #: /bcgov/entity#25328
Description of changes:
Post new NoW DRAFT:
Get NoW DRAFT (156943):
Update and Save NoW DRAFT:
Params:
Body (updating certifiedBy field):
Response:
Get NoW DRAFT to confirm update was saved:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).