-
Notifications
You must be signed in to change notification settings - Fork 53
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
Improve dummy data generation #139
Comments
This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions. |
Hey @aldesantis, I saw this recent commit. From my standpoint, the approach n. 3 could be good in this case in order to avoid the creation of DB entities entirely if possible. |
@blocknotes that's right, we're still interested in doing this, but we want to do it right. 😛 As far as the approach goes, I also think number 3 is the most promising. Let me know if you need anything and good luck! |
This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions. |
This is related to #138.
It is currently almost impossible to display a subscription's total in a reliable way. The current implementation (
SolidusSubscriptions::SubscriptionLineItem#dummy_line_item
) has several flaws:The biggest architectural problem is that there is no way to reliably compute an order's total if that order is not persisted in the DB.
Spree::OrderUpdater
not only relies on a lot of information being persisted, but also persists the order after calculating the totals, so it wouldn't work with an ephemeral/frozen order.The solutions I currently see are:
spree_orders
table with fake data (although this can probably be mitigated with a custom column and a default scope that causesSpree::Order
to ignore it).Spree::OrderUpdater
. I'm not 100% sure this is possible without persisting certain data (e.g. shipments) to the DB, and we'd have to constantly keep our own calculations up-to-date with any changes in the core.Spree::OrderUpdater
with aSolidusSubscriptions::Subscription
object instead of aSpree::Order
object. We'd have to mock a lot of functionality, but it's potentially doable.Whatever solution we go with, we should completely disregard the original order that generated a subscription: it's not a reliable source of information about the subscription and all the data we need is already stored on the subscription itself.
The text was updated successfully, but these errors were encountered: