-
Notifications
You must be signed in to change notification settings - Fork 7
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
Delegate Fulfillment instead of using FulfillmentInfo (PP-1641) #2035
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2035 +/- ##
==========================================
+ Coverage 90.72% 90.75% +0.03%
==========================================
Files 342 342
Lines 40572 40516 -56
Branches 8796 8771 -25
==========================================
- Hits 36808 36772 -36
+ Misses 2503 2486 -17
+ Partials 1261 1258 -3 ☔ View full report in Codecov by Sentry. |
1fdb345
to
d166625
Compare
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.
This looks good to me.
There are a couple of small comments below, but nothing super important.
A broader comment is that some of the test and fixture classes still have "FulfillmentInfo" in their names.
active attempt to fulfill the loan. | ||
:param locked_to: A DeliveryMechanismInfo object representing the | ||
delivery mechanism to which this loan is 'locked'. | ||
""" | ||
super().__init__(collection, data_source_name, identifier_type, identifier) | ||
self.start_date = start_date | ||
self.end_date = end_date | ||
self.fulfillment_info = fulfillment_info | ||
self.fulfillment = fulfillment |
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.
Self fulfillment is sooooo important! 🙃
src/palace/manager/api/axis.py
Outdated
debug_message=error_details, | ||
) | ||
def __init__( | ||
self, content_link: str, content_type: str | None, verify: bool |
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.
Could this content_type
default to DeliveryMechanism.ADOBE_DRM
? Would we be calling this with any others?
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.
Makes sense. I'll change that.
@tdilauro I think I got all the ones that need to be changed. Its a bit annoying, the axis API has an API call named circulation/src/palace/manager/api/axis.py Line 185 in d166625
|
Description
Refactor
FulfillmentInfo
class which just contained information about a fufillment, but had multiple methods to override how fulfillment was done, to be a new class calledFulfillment
which the loans controller delegates fulfillment to.This lets each API control how fulfillment is done, and reduces the amount of if / then we need to have in the loan controller. We define several types of Fulfillment, corresponding to the logic that used to exist in the loans controller, and update the API classes to use them.
The goal of this PR is the have fulfillment for each API act the same way before and after, just refactoring to use the new structure.
Motivation and Context
This refactor builds on #2034 and is part of the work needed for #2033. We are already effectively delegating control of the fulfillment, but not being explicit about it, so I think this refactor makes it easier to reason about how fulfillment will work.
How Has This Been Tested?
Checklist