-
Notifications
You must be signed in to change notification settings - Fork 40
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
12777 - System Exit 1 / Performance fixes for Invoice searching, also statement building #1065
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1065 +/- ##
==========================================
- Coverage 91.53% 91.51% -0.02%
==========================================
Files 162 162
Lines 10626 10609 -17
==========================================
- Hits 9726 9709 -17
Misses 900 900
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -213,19 +226,24 @@ def search_purchase_history(cls, # pylint:disable=too-many-arguments, too-many- | |||
|
|||
if not return_all: | |||
# Add pagination | |||
pagination = query.paginate(per_page=limit, page=page) | |||
result, count = pagination.items, pagination.total | |||
sub_query = query.with_entities(Invoice.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.
query.paginate
wouldn't seem to work for me. I've had a similar issue with routing slips before.
@@ -48,8 +48,6 @@ | |||
|
|||
LEGISLATIVE_TIMEZONE = 'America/Vancouver' | |||
DT_SHORT_FORMAT = '%Y-%m-%d' | |||
INCORPORATION_LABEL = 'Incorporation Number:' |
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.
LEAR stuff
@@ -175,15 +171,4 @@ def _clean_up(self, data, many): # pylint: disable=unused-argument | |||
if data.get('status_code') == InvoiceStatus.PAID.value: | |||
data['status_code'] = PaymentStatus.COMPLETED.value | |||
|
|||
# If it's a BUSINESS invoice, then push details. | |||
|
|||
if data.get('business_identifier', None): |
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.
Pay doesn't care about invoice details that should be provided from lear
This is also a huge performance hit when searching invoices
Kudos, SonarCloud Quality Gate passed!
|
line_item_schema = PaymentLineItemSchema(exclude=('id', 'line_item_status_code')) | ||
line_item_dict = line_item_schema.dump(payment_line_item) | ||
line_item_dict['filing_type_code'] = payment_line_item.fee_schedule.filing_type_code | ||
invoice['line_items'].append(line_item_dict) |
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.
nice
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.
Nice work! LGTM
Issue #:
bcgov/entity#12777
Description of changes:
search_purchase_history
to use only needed fields and joinscreate_payment_report_details
so it wont requery the database when the information is already availableBy 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).