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

12777 - System Exit 1 / Performance fixes for Invoice searching, also statement building #1065

Merged
merged 2 commits into from
Jan 13, 2023

Conversation

seeker25
Copy link
Collaborator

@seeker25 seeker25 commented Jan 13, 2023

Issue #:
bcgov/entity#12777

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 added the bug Something isn't working label Jan 13, 2023
@seeker25 seeker25 changed the title 12777 - Performance fixes for Invoice searching, also statement building. 12777 - System Exit 1 / Performance fixes for Invoice searching, also statement building. Jan 13, 2023
@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Merging #1065 (b76ae05) into main (ce34e37) will decrease coverage by 0.01%.
The diff coverage is 60.60%.

@@            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              
Flag Coverage Δ
eventlistenerqueue 81.63% <ø> (ø)
payadmin ∅ <ø> (∅)
payapi 93.86% <90.00%> (-0.02%) ⬇️
paymentjobs 78.92% <15.38%> (ø)
paymentreconciliationsqueue 91.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ayment-jobs/tasks/bcol_refund_confirmation_task.py 72.54% <0.00%> (ø)
pay-api/src/pay_api/utils/constants.py 100.00% <ø> (ø)
pay-api/src/pay_api/models/payment.py 94.16% <80.00%> (+0.08%) ⬆️
jobs/payment-jobs/tasks/routing_slip_task.py 88.88% <100.00%> (ø)
pay-api/src/pay_api/models/invoice.py 100.00% <100.00%> (ø)
pay-api/src/pay_api/services/payment.py 97.06% <100.00%> (-0.04%) ⬇️
pay-api/src/pay_api/utils/enums.py 100.00% <100.00%> (ø)
pay-api/src/pay_api/version.py 100.00% <100.00%> (ø)
... and 1 more

@seeker25 seeker25 changed the title 12777 - System Exit 1 / Performance fixes for Invoice searching, also statement building. 12777 - System Exit 1 / Performance fixes for Invoice searching, also statement building Jan 13, 2023
@@ -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).\
Copy link
Collaborator Author

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:'
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

@seeker25 seeker25 Jan 13, 2023

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

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.8% 1.8% Duplication

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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

Copy link
Collaborator

@kialj876 kialj876 left a comment

Choose a reason for hiding this comment

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

Nice work! LGTM

@seeker25 seeker25 merged commit ff4f694 into bcgov:main Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants