-
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
24195 tweaks on filing queries #3166
24195 tweaks on filing queries #3166
Conversation
@@ -511,7 +511,6 @@ def json(self, slim=False): | |||
'lastLedgerTimestamp': self.last_ledger_timestamp.isoformat(), | |||
'lastAddressChangeDate': '', | |||
'lastDirectorChangeDate': '', | |||
'lastModified': self.last_modified.isoformat(), |
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.
included in _slim_json
@@ -896,7 +896,7 @@ def get_filings_by_types(business_id: int, filing_types): | |||
filter(Filing.business_id == business_id). \ | |||
filter(Filing._filing_type.in_(filing_types)). \ | |||
filter(Filing._status == Filing.Status.COMPLETED.value). \ | |||
order_by(desc(Filing.effective_date)). \ | |||
order_by(desc(Filing.transaction_id)). \ |
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.
order with transaction_id for COMPLETED filing queries
@@ -80,7 +80,6 @@ def get_businesses(identifier: str): | |||
recent_filing_json = CoreFiling.get_most_recent_filing_json(business.id, None, jwt) | |||
if recent_filing_json: | |||
business_json['submitter'] = recent_filing_json['filing']['header']['submitter'] | |||
business_json['lastModified'] = recent_filing_json['filing']['header']['date'] |
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.
Not required to override. lastModified will be updated in entity-filer while processing a filing
if filing.transaction_id: # transaction_id will be None for the pending filings (intermediate state) | ||
query = query.filter(Filing.transaction_id < filing.transaction_id) | ||
|
||
return query.order_by(Filing.transaction_id.desc()).first() |
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.
order with transaction_id for COMPLETED filing queries
|
max_filing = max_filing.filter(Filing._filing_sub_type == filing_sub_type) | ||
max_filing = max_filing.subquery() | ||
def get_most_recent_filing(business_id: str, filing_type: str = None, filing_sub_type: str = None): | ||
"""Return the most recent filing. |
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.
Simplified and generalize this function
Issue #: /bcgov/entity#24195
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 lear license (Apache 2.0).