Moved the update_dates() call to update them after updating the subscription status #202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When you're importing expired subscriptions with their "End date", this date is automatically replaced by the current date (the importation time).
Steps to replicate
_schedule_end
] from the database to have an old date)Expected results
After importing the subscription, its "End date" should be the same date that was specified in the CSV.
Result
The "End date" of the imported subscription is replaced with the current date.
Origin of the issue
I see that the plugin updates the dates of the subscription before updating its status. In this case, when the status of a subscription is updated to "Expired", it overwrites the "End date" with the current date.
Note
I suggest to move the update_dates() call after the update_status() to make sure that the imported dates are preserved. I'm not sure though if removing this call from the previous location affects any specific cases (at first glance, this change doesn't seem problematic, as both methods will be called anyway, and the doesn't seem to be any specific reason to update the subscription dates before).
Fixes #201