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

Feature/ruby 2477 wcr tech upgrade to rails 7 #1389

Merged
merged 49 commits into from
Oct 4, 2023

Conversation

jjromeo
Copy link
Contributor

@jjromeo jjromeo commented Jun 14, 2023

No description provided.

@jjromeo jjromeo force-pushed the feature/RUBY-2477-wcr-tech-upgrade-to-rails-7 branch from 15c00ee to 55f4ffe Compare June 16, 2023 14:02
@jjromeo jjromeo force-pushed the feature/RUBY-2477-wcr-tech-upgrade-to-rails-7 branch from 0ac6d2e to 9282f36 Compare June 21, 2023 11:08
@jjromeo jjromeo force-pushed the feature/RUBY-2477-wcr-tech-upgrade-to-rails-7 branch from c6964bb to 9b9c69b Compare July 6, 2023 10:36
@jjromeo jjromeo force-pushed the feature/RUBY-2477-wcr-tech-upgrade-to-rails-7 branch from c98ebe8 to cd0f568 Compare July 11, 2023 14:16
@@ -12,7 +12,12 @@ def merge_finance_details
registration.finance_details.orders << order
end

transient_payments_array = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was it necessary to break this into two steps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code used to be

transient_registration.finance_details.payments.each do |payment|
   registration.finance_details.payments << payment
end

This is because the each loop was actually not working properly when called on transient_registration.finance_details.payments. The loop actually does not complete and I believe it's due to transient_registration.finance_details.payments being edited by the line inside the loop (payment can only belong to one payments collection at a time). The breaking up was a way to ensure each payment actually gets iterated on. I will add a comment to that effect

Copy link
Contributor

@PaulDoyle-EA PaulDoyle-EA Aug 8, 2023

Choose a reason for hiding this comment

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

But the line inside the loop in the previous code is acting on the registration, not on the transient_registration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes the line is acting on the registration, but if you move a payment from transient_registration.finance_details.payments into registration.finance_details.payments it has edited the transient_registration.finance_details.payments array during the iteration

Copy link
Contributor

@PaulDoyle-EA PaulDoyle-EA Aug 8, 2023

Choose a reason for hiding this comment

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

I don't see from the old code snippet how that could have happened. There is a loop over all the payments in the transient_registration. The body of the loop acts on the registration, not on the transient_registration. It's not moving the payment from the transient_registration to the registration, it's copying it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the spec that I was trying to fix, it was not copying it, but moving it instead

@@ -97,7 +97,7 @@ def extend_expiry_date
end

def create_order_item_logs
OrderItemLog.create_from_registration(transient_registration)
OrderItemLog.create_from_registration(registration)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the order_item_log be created based on the new order dat in the transient_registration, not what was previously stored on the registration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the data can be different? I added a spec to check if it would be the same

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes - the registration should have all order items since it was created, so for example the items from the original registration order; some copy cards ordered a few months later; and a renewal order. The transient registration should have only the order items from the current session. I'm fairly sure that copying from the registration (if it has previous order items) would result in duplication of the older ones.

@@ -19,6 +18,6 @@
business_type: business_type,
tier: tier,
key_people: key_people,
metaData: { route: route })
metaData: { route: nil })
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was it necessary to change this to nil? All registrations should have a route.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because this test is trying to test the metadata route being set, but that context is setting it in an implicit way that stops the test working

PaulDoyle-EA
PaulDoyle-EA previously approved these changes Aug 10, 2023
iteration when merging finance details

- Return order item log to being created from a transient registration
  rather than a registration
- Allow getting to registration from finance details of a transient
  registration
- reload finance details so orders are present
- Go back to using interim array rather than cloning for correcting
  issue with embedded document parent not being correct
- Add interim array for duplication for orders that was present for
  payments
- Add extra order to renewal_completion_service_spec to ensure it can
  handle multiple orders as well as multiple payments
@jjromeo jjromeo force-pushed the feature/RUBY-2477-wcr-tech-upgrade-to-rails-7 branch from b37ee68 to 67319d8 Compare August 11, 2023 10:46
@jjromeo jjromeo force-pushed the feature/RUBY-2477-wcr-tech-upgrade-to-rails-7 branch from 8125ad5 to 52db1b5 Compare September 21, 2023 13:31
@jjromeo jjromeo merged commit 928d391 into main Oct 4, 2023
5 checks passed
@jjromeo jjromeo deleted the feature/RUBY-2477-wcr-tech-upgrade-to-rails-7 branch October 4, 2023 13:15
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