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

Introduce SolidusPromotions #5805

Merged
merged 524 commits into from
Oct 26, 2024
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Oct 25, 2024

  1. Order Discounter: Reset current discounts after promo calculations

    If we don't do this, and an in-memory order is calculated twice, we run
    the risk of wrong amounts. This is usually guarded against by calling
    `order.reset_current_discounts` in the `FriendlyPromotionDiscounter`,
    but the spec for the `AdjustLineItemQuantityGroups` action creates an
    order (calling `recalculate`) and then calls `compute_amount` with the
    stale discounts still on the order's line items.
    
    Anyways - After persisting adjustments, we can drop the current
    discounts.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ed71004 View commit details
    Browse the repository at this point in the history
  2. Add UI bits for AdjustLineItemQuantityGroups

    We need to have the new action available, and we need it to have a
    partial.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    03f34fa View commit details
    Browse the repository at this point in the history
  3. Leverage PromotionAction#level for display purposes

    The previous version did not work for an action whose name does not end
    in either `LineItem` or `Shipment`. Luckily we now have the `:level`
    method.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    6827510 View commit details
    Browse the repository at this point in the history
  4. Add AdjustLineItemQuantityGroups to promotion map

    Easy upgrades are good!
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    53b2ea6 View commit details
    Browse the repository at this point in the history
  5. Fix order discounter spec

    We've refactored `call` out of the subject, but this PR did not know
    about that.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    64e270a View commit details
    Browse the repository at this point in the history
  6. Use new NestedClassSet for configuring calculators

    We have several actions, and several calculators. Not all calculators
    work for all actions (e.g. the DistributedAmountCalculator really only
    works for the AdjustLineItem action, and the `Tiered` ones don't work
    for `AdjustLineItemQuantityGroups`. Rather than creating a new
    configuration option for each calculator, let's use something like a
    Hash here.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d0d3f53 View commit details
    Browse the repository at this point in the history
  7. Add bundler/gem_tasks

    This is to allow us to release versions in a simple, standard-compliant
    fashion.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    5ab5508 View commit details
    Browse the repository at this point in the history
  8. Refactor to FriendlyPromotion::FriendlyPromotionAdjuster

    This changes the API of the main class we're working with from
    `SolidusFriendlyPromotions::OrderDiscounter` to
    `SolidusFriendlyPromotions::FriendlyPromotionsAdjuster`. This class now
    simply calls the three other (otherwise somewhat confusingly named)
    service objects:
    
    - `LoadPromotions`
    - `DiscountOrder`
    - `PersistDiscountedOrder`
    
    This makes the code easier to read in my opinion, and simplifies the
    API for promotion handlers significantly.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c3243b6 View commit details
    Browse the repository at this point in the history
  9. Rename: "additional_promotion" -> "dry_run_promotion"

    When we test whether a promotion is eligible, what we do is we perform a
    dry run of the promotion adjuster. This change reflects that context in
    the naming of our arguments.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3681cea View commit details
    Browse the repository at this point in the history
  10. Move DiscountableAmounts into app/models/concerns

    This is to aid readability.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    122193f View commit details
    Browse the repository at this point in the history
  11. Refactor ChoosePromotions service class

    This class suffered of unnecessary variables, and can also live with the
    service classes for the FriendlyPromotionAdjuster.
    
    It also could use a spec.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3846876 View commit details
    Browse the repository at this point in the history
  12. Move rule concerns to app/concerns

    These are modules, and Rails offers a place for modules.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    90dc209 View commit details
    Browse the repository at this point in the history
  13. Bump Version to 1.0.0.pre

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3ad195b View commit details
    Browse the repository at this point in the history
  14. Add a null promotion handler

    This class is useful for satisfying Solidus' need for a shipping
    promotion handler. With SolidusFriendlyPromotions, shipping promotions
    are handled just like other promotions, so we don't need to do anything
    here.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0683b19 View commit details
    Browse the repository at this point in the history
  15. Goodies: Create spec

    We want to have an action that creates a new discounted line item. Its
    discount should never be affected by promotions in previous lanes.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0d955e4 View commit details
    Browse the repository at this point in the history
  16. Add action association to LineItem

    We want to be able to add a line item associated to a promotion actions
    (to see who created it).
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    1887e27 View commit details
    Browse the repository at this point in the history
  17. Add basic version of CreateDiscountedItem class

    This also introduced the `SolidusFriendlyPromotion::Actions::Automation`
    module that indicates this action is an automation. It's only available
    at the order level.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    eff7322 View commit details
    Browse the repository at this point in the history
  18. Make sure goodies are not treated like regular line items

    Solidus offers line item comparison hooks, and we'll make use of them.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d32136d View commit details
    Browse the repository at this point in the history
  19. Working automations!

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    fa30fcd View commit details
    Browse the repository at this point in the history
  20. Initialize variant autocomplete on page load

    This is not done automatically in Solidus, so we have to do it here.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    02affac View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    edc44d6 View commit details
    Browse the repository at this point in the history
  22. Calculators and Actions: Ignore automatic items

    Automatic items are probably already 100% discounted, and it's really
    hard to make their discounts play well with others.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d7dce3c View commit details
    Browse the repository at this point in the history
  23. Allow specifying quantity

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    23f0589 View commit details
    Browse the repository at this point in the history
  24. Bump version

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e36e1e8 View commit details
    Browse the repository at this point in the history
  25. Lint: Fix standardrb error

    StandardRb has added a new Cop.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    9fadb78 View commit details
    Browse the repository at this point in the history
  26. Update MIGRATING.md

    Small typo
    tvdeyen authored and mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e67150c View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    3907ee3 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    23949cd View commit details
    Browse the repository at this point in the history
  29. Add lane to table

    We want to see at a glance what the lanes of our promotions are.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    331cb16 View commit details
    Browse the repository at this point in the history
  30. Only display usage count for for promotions with usage limit

    It's quite slow to calculate usage counts. Let's instead display an
    infinity symbol for promotions that don't have a usage limit.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    2ff7292 View commit details
    Browse the repository at this point in the history
  31. Usage: Indicate usage of promotions without usage limit

    When a promotion has no usage limit, we can still tell admins whether a
    promotion has been used at all. Counting one is not so hard.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0959ab3 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    f037db2 View commit details
    Browse the repository at this point in the history
  33. Allow filtering by active date

    This does not set a default filter, so we can still see all promotions,
    but it's real easy to set the filter to today.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3c35bb6 View commit details
    Browse the repository at this point in the history
  34. Allow filtering by lane

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b91360c View commit details
    Browse the repository at this point in the history
  35. Fix translation for "number of codes"

    This way the column makes more sense in the admin.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    de58dda View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    5ee47d8 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    3be188e View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    f9809a2 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    a60fc8e View commit details
    Browse the repository at this point in the history
  40. Remove clearfix

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    387ba07 View commit details
    Browse the repository at this point in the history
  41. Use short format

    The long one takes away a lot of row space.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    9793fea View commit details
    Browse the repository at this point in the history
  42. Use Remix icons if Solidus' admin_updated_navbar is enabled

    Solidus 2.4 introduced a new admin navbar with new icons
    that can be enabled in the settings. Adopt to that.
    tvdeyen authored and mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    6400ebe View commit details
    Browse the repository at this point in the history
  43. Coupon Promo Handler: Fix flaky spec

    Promotion Rules are not ordered, so the database might return them in
    any order. This adjusts the spec accordingly (especially Postgres
    returns them in a different order than expected sometimes).
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    85ef429 View commit details
    Browse the repository at this point in the history
  44. Refactor: Extract Promotion#applicable_line_items

    There are now three spots in this code base that need a method to collect
    the line items that pass all applicable rules for an order and can be
    discounted. Time to extract.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ce0859b View commit details
    Browse the repository at this point in the history
  45. Allow changing quantity for automatic line items

    When we do a buy-one-get-one-free promotion, you should get TWO free
    when you buy two.
    
    Ruby doesn't really allow changing methods based on who calls, so we
    have to use the `quantity_setter` attr_accessor as a kind of lock that
    unlocks setting the quantity when we want it.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3a8f62c View commit details
    Browse the repository at this point in the history
  46. Make CreateDiscountedItem able to do Buy N get N free

    There's two quantities we want to configure. Buy X get Y free...
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8b2f548 View commit details
    Browse the repository at this point in the history
  47. Provide calculator description with calculator fields

    Without the description, the calculator name might not tell you enough
    about how the calculator works. This is especially true for the tiered
    calculcators.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a573bb5 View commit details
    Browse the repository at this point in the history
  48. Create tiered calculator based on eligible item quantity

    So you get a percentage based on how many items that match the criteria
    the customer has in their cart!
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    19d586c View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    e9db977 View commit details
    Browse the repository at this point in the history
  50. Version bump: 1.0.0.rc.2

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    151b173 View commit details
    Browse the repository at this point in the history
  51. Add Changelog

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    80843e8 View commit details
    Browse the repository at this point in the history
  52. Fix typo

    jarednorman authored and mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    20204a9 View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    5c2272c View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    a407410 View commit details
    Browse the repository at this point in the history
  55. Configuration menu
    Copy the full SHA
    8f8597e View commit details
    Browse the repository at this point in the history
  56. Replace references to OrderDiscounter with FriendlyPromotionAdjuster

    The default promotion adjuster has been renamed, and that has to be
    reflected in the README and in the migration guide.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    f1b895a View commit details
    Browse the repository at this point in the history
  57. Documentation: Use released version of this gem

    We want user's to take advantage of semantic versioning.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ad95d45 View commit details
    Browse the repository at this point in the history
  58. Add section about migrating Coupon Promotion Handler

    This adds a documentation section so people know they have to change
    explicit references to the legacy system's promotion handler.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d871763 View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    895b482 View commit details
    Browse the repository at this point in the history
  60. Configuration menu
    Copy the full SHA
    051b8cb View commit details
    Browse the repository at this point in the history
  61. Fix standardrb violations

    New standard version, new rules, new fixes.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b79fc70 View commit details
    Browse the repository at this point in the history
  62. Add configuration option: recalculate_complete_orders

    This gem allows recalculating complete orders until they are shipped,
    because Solidus allows changing an order's contents until the order is
    shipped.
    
    This change adds a configuration option that disables the
    recalculation of orders after they are completed. Some shops make
    changes to existing promotions, and expect that this does not change
    complete, but unshipped orders.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    f5bc4e0 View commit details
    Browse the repository at this point in the history
  63. Bump version to rc.3

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    df022ae View commit details
    Browse the repository at this point in the history
  64. Define SolidusFriendlyPromotions.table_name_prefix early

    In Rails 7.1.3, the `table_name_prefix` method is redefined if it is not
    already defined. Since we have multiple module definitions, we need to
    make sure that the class method is defined before we load `engine.rb`.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    bd7bc5f View commit details
    Browse the repository at this point in the history
  65. Revert "Temporarily disable running specs for Solidus main"

    This reverts commit 6a69d1a35340b650fec1040da8184b4ec59964f1.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    f7bdc68 View commit details
    Browse the repository at this point in the history
  66. Add admin UI for promotion code batches

    This was somehow missed in the past.
    
    Fixes solidusio#93
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c03a305 View commit details
    Browse the repository at this point in the history
  67. Add missing association between promo codes and order promotions

    This fixes the foreign key constraint error when deleting a promotion
    code that has been applied to an order.
    
    This will, of course, change the applicability of the promotion in
    question for that particular order. If the order is shipped, no worries
    though: The adjustments will stay as our service object will not try to
    recalculate. If the order is not shipped, the promotion will stop being
    applied. However, if you as a user deleted the promotion or the
    promotion code, that's probably what you want.
    
    Fixes solidusio#94
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    42cb6f8 View commit details
    Browse the repository at this point in the history
  68. Add Promotion#discarded_at

    Let's use the `discard` gem for soft-deleting promotions.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    041493b View commit details
    Browse the repository at this point in the history
  69. Configuration menu
    Copy the full SHA
    734e7f0 View commit details
    Browse the repository at this point in the history
  70. Disable the new admin temporarily

    There are still a few bugs with the new admin, so let's disable that
    for the time being.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    7fb5e73 View commit details
    Browse the repository at this point in the history
  71. UI work for soft-deleted promotions

    We don't want to allow people to edit or re-create deleted promotions,
    so we just indicate they're there for now. Let's see if we find a need
    to show them in some kind of uneditable mode.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e50f9e3 View commit details
    Browse the repository at this point in the history
  72. Disallow destroying promotion actions for completed orders

    When a promotion has been applied to an order, we need to make sure no
    adjustments remain that have that promotion's actions as their source.
    For incomplete orders, we can simply delete the adjustments, but for
    complete orders, we must stop the promotion action from being deleted.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    87b5529 View commit details
    Browse the repository at this point in the history
  73. Actually destroy promotion actions

    We now protect against destroying promotion actions that have been
    applied to a complete order, so we can stop the dependent: :nullify
    thing.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8e4099d View commit details
    Browse the repository at this point in the history
  74. Actually destroy promotion actions

    There's no need for soft-delete on promotion actions, now that we have
    soft-delete on promotions.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c922269 View commit details
    Browse the repository at this point in the history
  75. Drop deleted_at from promotion actions

    We don't need soft-delete on promotion actions when we have soft-delete
    on promotions.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    cb6376b View commit details
    Browse the repository at this point in the history
  76. Fix URI in gemspec

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    23cbea2 View commit details
    Browse the repository at this point in the history
  77. Bump version to 1.0

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    03c22a5 View commit details
    Browse the repository at this point in the history
  78. Log Changes

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    21d4221 View commit details
    Browse the repository at this point in the history
  79. Fix helpers

    We were using Spree helpers before; those don't exist anymore.
    
    Also we missed importing the PromotionsHelper, and implicitly relied on
    the one provided by Solidus.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    75d2600 View commit details
    Browse the repository at this point in the history
  80. Use local partials

    In some spots we were still relying on Solidus partials, even though we
    have them in the app.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    66b7f37 View commit details
    Browse the repository at this point in the history
  81. Configuration menu
    Copy the full SHA
    6b15852 View commit details
    Browse the repository at this point in the history
  82. Change activation UI to not rely on JS

    Previously, the activation UI for promotions was based on complicated
    Javascript. This change allows us all the same options, and the user
    will be warned by validation errors if they try to create a promotion
    with both a code and the apply automatically option set. For existing
    promotions, `apply_automatically` will be disabled if either a path is
    set or a promo code is set.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3ab16c2 View commit details
    Browse the repository at this point in the history
  83. Configuration menu
    Copy the full SHA
    1f4b2ab View commit details
    Browse the repository at this point in the history
  84. Reintroduce nilling empty paths

    This got by undetected because the spec was using the wrong model name.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b6b082c View commit details
    Browse the repository at this point in the history
  85. Configuration menu
    Copy the full SHA
    d33831f View commit details
    Browse the repository at this point in the history
  86. Display path input field if present

    If this promotion is activated by a path, it makes sense to be able to
    change it.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e1f8dd9 View commit details
    Browse the repository at this point in the history
  87. Restrict SQLite to "~> 1.3"

    SQLite 2.0 has recently been released, but the Rails/Solidus ecosystem
    isn't quite there yet.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a0ad748 View commit details
    Browse the repository at this point in the history
  88. Fix ShippingRateDiscount#promotion_action

    Promotion actions are not soft-deletable anymore.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8e035d4 View commit details
    Browse the repository at this point in the history
  89. don't support Ruby < 3

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c29ec2d View commit details
    Browse the repository at this point in the history
  90. Don´t support Solidus < 2.11

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ef55c01 View commit details
    Browse the repository at this point in the history
  91. Bump Ruby versions to 3.1+

    3.0 restricts us to an older Rails version which uses Selenium the wrong
    way.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    43acff9 View commit details
    Browse the repository at this point in the history
  92. Fix Promotion Rule Unique per promotion validation

    This used outdated syntax that did not actually work, and the spec
    indicated invalidity because of the promotion with ID = 1 not existing.
    
    Now we create a real promotion to test with, and we add the error in the
    correct way. As a bonus, we use I18n for the error message.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    9f92093 View commit details
    Browse the repository at this point in the history
  93. Fix discount order spec

    The spec setup of this spec added two rules of the same type to a
    promotion. Because the uniqueness validation was flawed, this was not a
    problem previously.
    
    We're now adding a different type of line item rule here. The behavior
    of the spec stays mostly the same, but the error message changes
    (because the `LineItemTaxon` rule does not have super-nice errors).
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    dd38d28 View commit details
    Browse the repository at this point in the history
  94. Bump version to 1.0.1

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b8a2418 View commit details
    Browse the repository at this point in the history
  95. Update Changelog

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    aa3cd22 View commit details
    Browse the repository at this point in the history
  96. Add rule reference to actions

    Associate promotion rules with their conditions
    
    It's easier to understand if we have multiple promotion actions that
    each have multiple promotion rules, than if we have multiple promotion
    actions that share a set of promotion rules on the promotion, some of
    which are relevant to the promo action and some which are not.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    09651b6 View commit details
    Browse the repository at this point in the history
  97. Remove "relevant rules" method

    This will be covered by directly associating rules to actions.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8ed05a7 View commit details
    Browse the repository at this point in the history
  98. Adjust friendly promotion adjuster spec

    Interestingly, these specs are still green.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    51361b6 View commit details
    Browse the repository at this point in the history
  99. Configuration menu
    Copy the full SHA
    d178787 View commit details
    Browse the repository at this point in the history
  100. Promotion Rule: Rename "unique_per_promotion"

    Also fix the error message to reference the action. Promotions can now
    have the same rule twice!
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8438b0f View commit details
    Browse the repository at this point in the history
  101. Do not initialize pickers twice

    Solidus Backend already initializes the pickers, if we do it a second
    time, an error occurs.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    df7d6a6 View commit details
    Browse the repository at this point in the history
  102. Nest rules under actions in UI

    This large commit removes a lot of complexity by scoping rules to
    actions.
    
    Now, we do not have to distinguish between rules that apply for all
    actions and rules that are scoped to only some actions, and it's far
    more understandable how a rule comes to be.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    caaee28 View commit details
    Browse the repository at this point in the history
  103. Create promotion advertiser

    This is to create the API needed for fulfilling the contract described
    in solidusio#5739.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3d2d485 View commit details
    Browse the repository at this point in the history
  104. Provide extension point for advertiser class

    Again, this is to fulfil the API requirements specified in
    solidusio#5739.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    f4789ce View commit details
    Browse the repository at this point in the history
  105. Rename Promotion Rule Route and Controller

    ... also rename all the partials.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8f51f08 View commit details
    Browse the repository at this point in the history
  106. Rename promotion rule to "condition"

    A rule is conceptually conditions attached to an action. In this gem,
    hoever, what we call "rules" are just conditions. This renames them
    appropriately.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    65f69c1 View commit details
    Browse the repository at this point in the history
  107. Move condition form partials to admin/condition_forms

    This reads much better than `admin/conditions/conditions`.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a1b3ae4 View commit details
    Browse the repository at this point in the history
  108. Rename promotion action to benefits: Routes, Controllers, Views

    Promotion Action is very generic and wordy. Just using "Action" does not
    work, because Rails will confuse it with its own concept of "Action".
    This changes the routes and params, and moves the individual promotion
    action forms to a benefit_forms directory.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    30ad834 View commit details
    Browse the repository at this point in the history
  109. Rename PromotionAction model to Benefit

    It's clearer, and does not conflict with a lot of Rails nomenclature.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    cdcf165 View commit details
    Browse the repository at this point in the history
  110. Remove .rubocop_todo.yml

    This file has not been in use.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    5004a5e View commit details
    Browse the repository at this point in the history
  111. Remove level checks in the UI

    These checks are not necessary any longer.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    772336e View commit details
    Browse the repository at this point in the history
  112. Fix sandbox script

    Not sure why this had to be updated.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    5c2886d View commit details
    Browse the repository at this point in the history
  113. Add validation for condition type

    Not all conditions work for all benefits. Validating this helps us with
    the UI, and it exposes some odd things in the spec suite.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a8d0117 View commit details
    Browse the repository at this point in the history
  114. Fix missing translations

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4e9dbfb View commit details
    Browse the repository at this point in the history
  115. Use Bootstrap cards to improve Admin UI

    We don't have the CSS from the classic promotions admin - but that CSS
    wasn't all that great to begin with. However, we do have Bootstrap and
    can make full use of it.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b9d74d8 View commit details
    Browse the repository at this point in the history
  116. Convert product picker to Web Component

    Much easier than having to initialize manually.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    9f99b21 View commit details
    Browse the repository at this point in the history
  117. Prettier tier fields

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    84af1ae View commit details
    Browse the repository at this point in the history
  118. rebase product picker

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    830ae1b View commit details
    Browse the repository at this point in the history
  119. Configuration menu
    Copy the full SHA
    102e139 View commit details
    Browse the repository at this point in the history
  120. Make UserPicker WebComponent

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    bf64aa0 View commit details
    Browse the repository at this point in the history
  121. Configuration menu
    Copy the full SHA
    c347cc1 View commit details
    Browse the repository at this point in the history
  122. Configuration menu
    Copy the full SHA
    813e66b View commit details
    Browse the repository at this point in the history
  123. Convert NumberWithCurrency to WebComponent

    This isn't quite working yet.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    26e93a2 View commit details
    Browse the repository at this point in the history
  124. Re-introduce Buttons

    We want to have some friction here, and communicate clearly there's no
    benefits or conditions.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e2d6c39 View commit details
    Browse the repository at this point in the history
  125. Fix User Role component

    We also wrap selecttwo in a Web Component, because it's just so good.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c7d0469 View commit details
    Browse the repository at this point in the history
  126. Import preference field partials from Solidus

    Use form-group everywhere.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    77a7211 View commit details
    Browse the repository at this point in the history
  127. Improve Flexi Rate form

    This form was almost unintelligible before this change.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    2b62b3b View commit details
    Browse the repository at this point in the history
  128. Improve Tiered Flat Rate form

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    7f36e44 View commit details
    Browse the repository at this point in the history
  129. Improve spacing

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b3b280d View commit details
    Browse the repository at this point in the history
  130. Improve percent calculator field

    This should be a number field, and it's the most important calculator
    anyways.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    bbdb7c0 View commit details
    Browse the repository at this point in the history
  131. Configuration menu
    Copy the full SHA
    a754508 View commit details
    Browse the repository at this point in the history
  132. Configuration menu
    Copy the full SHA
    c3d03ca View commit details
    Browse the repository at this point in the history
  133. Add space below type select

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4497f44 View commit details
    Browse the repository at this point in the history
  134. Configuration menu
    Copy the full SHA
    0ada88f View commit details
    Browse the repository at this point in the history
  135. Improve item total form

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    395fb83 View commit details
    Browse the repository at this point in the history
  136. Configuration menu
    Copy the full SHA
    1d6e145 View commit details
    Browse the repository at this point in the history
  137. Configuration menu
    Copy the full SHA
    8a78588 View commit details
    Browse the repository at this point in the history
  138. Rename folder "condition_forms" to "condition_fields"

    Explicit is better than implicit.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8fed749 View commit details
    Browse the repository at this point in the history
  139. Rename folder "condition_forms" to "condition_fields"

    Explicit is better than implicit.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d73ad82 View commit details
    Browse the repository at this point in the history
  140. Move calculator fields one level up

    Calculators are their own model, and we can just move them one level up,
    shortening some view references.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    eb4459c View commit details
    Browse the repository at this point in the history
  141. Fix homepage path in gemspec

    pelargir authored and mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    544e340 View commit details
    Browse the repository at this point in the history
  142. Include Discarded Promotions

    When applying or validating an order_promotion, we load all associated promotions and check their usage limit.
    A discarded promotion can still be associated with an order. If we do not load discarded promotions, then the
    order_promotion will not have an associated promotion and checking usage limits will result in an error.
    Andrew Manley authored and mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    6b6ee58 View commit details
    Browse the repository at this point in the history
  143. Add spec for destroying dependent order promotions

    When we delete a promotion, we want to be sure that dependent order
    promotions are also deleted.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8c2fba5 View commit details
    Browse the repository at this point in the history
  144. Delete cart connections when discarding promotions

    This is an additional safeguard that makes sure orders do not get
    discarded promotions applied to their carts (by removing any manual
    connections through e.g. promotion codes).
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ff86582 View commit details
    Browse the repository at this point in the history
  145. Update README to reflect naming changes

    Promotion Actions have been renamed to Benefits, and Promotion Rules to
    Conditions. This needs to be reflected in the README.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4da1597 View commit details
    Browse the repository at this point in the history
  146. Configuration menu
    Copy the full SHA
    09ba545 View commit details
    Browse the repository at this point in the history
  147. Configuration menu
    Copy the full SHA
    4edb2d3 View commit details
    Browse the repository at this point in the history
  148. Configuration menu
    Copy the full SHA
    f790e73 View commit details
    Browse the repository at this point in the history
  149. Configuration menu
    Copy the full SHA
    f3cded9 View commit details
    Browse the repository at this point in the history
  150. Configuration menu
    Copy the full SHA
    d92e4cd View commit details
    Browse the repository at this point in the history
  151. Configuration menu
    Copy the full SHA
    e4b185e View commit details
    Browse the repository at this point in the history
  152. Configuration menu
    Copy the full SHA
    aff229d View commit details
    Browse the repository at this point in the history
  153. Only run against Solidus' main branch

    Solidus' promotion configuration interface changes a bit in 4.4, and
    with SolidusFriendlyPromotions 2.0 we want to adapt those changes.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    494eb84 View commit details
    Browse the repository at this point in the history
  154. Use Spree::SimpleOrderContents

    We don't need to provide our own implementation any longer, Solidus
    ships with it!
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b527d5d View commit details
    Browse the repository at this point in the history
  155. Use Spree::Config.promotions.order_adjuster_class

    Solidus has a new configuration endpoint for the promotions order
    adjuster class. Implement it.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d9ff32f View commit details
    Browse the repository at this point in the history
  156. Remove patch to Spree::Order.apply_shipping_promotions

    This is not needed any longer, as this method is only implemented in
    solidus_legacy_promotions.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c7c5b7c View commit details
    Browse the repository at this point in the history
  157. Remove Spree::Order#ensure_promotions_eligible override

    This is present in Solidus core, identically.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    31c7cf2 View commit details
    Browse the repository at this point in the history
  158. Configuration menu
    Copy the full SHA
    728f971 View commit details
    Browse the repository at this point in the history
  159. Add Coupon Code Handler configuration

    This allows the API feature spec to go through.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    5a7ba03 View commit details
    Browse the repository at this point in the history
  160. Add Promotion Finder Class

    This is necessary for the API promotion endpoint to work.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    9857a37 View commit details
    Browse the repository at this point in the history
  161. Configuration menu
    Copy the full SHA
    4fc5705 View commit details
    Browse the repository at this point in the history
  162. Use Spree::Config.adjustment_promotion_source_types

    We don't need to override Spree::Adjustment.promotion and
    Spree::Adjustment#promotion?
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    9de61be View commit details
    Browse the repository at this point in the history
  163. Add OrderPromotionSubscriber

    This will reset the connected order promotions when an order is emptied.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3a2b889 View commit details
    Browse the repository at this point in the history
  164. Configuration menu
    Copy the full SHA
    e415253 View commit details
    Browse the repository at this point in the history
  165. Add RSpec. to specs

    Almost all of our specs don't use the RSpec DSL at the top level. This
    adds `RSpec.` to the ones that do.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    6c6dac0 View commit details
    Browse the repository at this point in the history
  166. Fix Conditions Request Spec

    This was relying on Solidus Legacy Promotions' permission set to be
    present, and it was testing the backend configuration with the redirect.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ff99687 View commit details
    Browse the repository at this point in the history
  167. Use our PromotionCodeBatchBuilder in spec

    Spree::PromotionCodeBatchBuilder is from another gem.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    67553f1 View commit details
    Browse the repository at this point in the history
  168. PromotionCodeBatchJob: Inherit from ActiveJob::Base

    We have no ApplicationJob.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d2bf5e8 View commit details
    Browse the repository at this point in the history
  169. Move default configuration from initializer to config

    With the initializer, we need a full Rails app to test the presence of
    the default classes. By leveraging `add_class_set` and
    `add_nested_class_set` from Solidus core with their `default` option, we
    don't need to do as much in the initializer.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8383e68 View commit details
    Browse the repository at this point in the history
  170. Configuration menu
    Copy the full SHA
    38c3585 View commit details
    Browse the repository at this point in the history
  171. Allow turbo-rails 2.0

    Without this, we get version conflicts (but our code works with both 1.4
    and 2.x)
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    2a29fd9 View commit details
    Browse the repository at this point in the history
  172. Workaround to stop ActionCable from loading

    We don't need ActionCable, and it's not loaded in our test suite.
    
    This stops Turbo from autoloading channels that need it. We don't need
    it.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0e3a223 View commit details
    Browse the repository at this point in the history
  173. Update MIGRATING.md

    This updates the `MIGRATING.md` file to reflect the current state of the
    gem.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    860a409 View commit details
    Browse the repository at this point in the history
  174. Move controllers and views to lib/

    This is the first step in making this gem independent of
    solidus_backend.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    f2c0788 View commit details
    Browse the repository at this point in the history
  175. Only do backend stuff if it's available

    We don't depend on solidus_backend, and stores should be able to load
    the extension even if they don't use the backend.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    884e35a View commit details
    Browse the repository at this point in the history
  176. Rename spec directory for backend tests

    Admin conflicts with the name for solidus_admin tests that will be
    coming up.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    1e3f6d6 View commit details
    Browse the repository at this point in the history
  177. Split rails_helper and spec_helper

    This mirrors what is done in Solidus core, and is cleaner anyways.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ee28fcc View commit details
    Browse the repository at this point in the history
  178. Use inline dummy app from Solidus core

    This is more in-line with the core Solidus gems, and it is also a lot
    faster.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    192e3b0 View commit details
    Browse the repository at this point in the history
  179. Configuration menu
    Copy the full SHA
    da03b06 View commit details
    Browse the repository at this point in the history
  180. Require legacy promotions for test suite

    Without this before the DummyApp call, we don't get the migrations and
    models from `solidus_legacy_promotions` that we need.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    bef8281 View commit details
    Browse the repository at this point in the history
  181. Support solidus_admin in the test suite

    This loads the SolidusAdmin gem if available, and adds the routes to the
    Dummy App if the example in question is marked `solidus_admin`. In
    addition, this loads the accessibility matchers many of the admin specs
    need.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    fb478fd View commit details
    Browse the repository at this point in the history
  182. Add component "SolidusFriendlyPromotionsBenefit"

    This allows the new Solidus Admin to display Adjustments with a source
    of type `SolidusFriendlyPromotions::Benefit`.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    cdfed87 View commit details
    Browse the repository at this point in the history
  183. Configuration menu
    Copy the full SHA
    b54cc16 View commit details
    Browse the repository at this point in the history
  184. Fix completed order with promotion factory

    This was referencing a factory from solidus_legacy_promotions
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ae24f22 View commit details
    Browse the repository at this point in the history
  185. Configuration menu
    Copy the full SHA
    e326f5e View commit details
    Browse the repository at this point in the history
  186. Add custom orders component

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d89865a View commit details
    Browse the repository at this point in the history
  187. Add promotion categories admin for solidus_admin

    This is all that's implemented in core currently.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    dc8a64e View commit details
    Browse the repository at this point in the history
  188. Configuration menu
    Copy the full SHA
    80ef2f4 View commit details
    Browse the repository at this point in the history
  189. Remove require_promotion_code override

    With solidusio@10b555b
    merged, we don't need this override anymore, and our build should go
    green again.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    266faa3 View commit details
    Browse the repository at this point in the history
  190. Rename Config.actions to Config.benefits

    This was an oversight.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    260fbde View commit details
    Browse the repository at this point in the history
  191. Fix more documentation

    This is still mentioning actions when we mean to say benefits.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    88464b9 View commit details
    Browse the repository at this point in the history
  192. Only add foreign key if necessary

    If this is a vanilla install, we cannot make a foreign key constraint to
    the `spree_promotions` table as it is not present.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    aea0326 View commit details
    Browse the repository at this point in the history
  193. Do not sync old order promotions by default

    In case we don't have the legacy promotion system present, we can't sync
    things by default.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    8c945ee View commit details
    Browse the repository at this point in the history
  194. Sync legacy order promotions by default in initializer

    This way we keep our specs clear of the legacy_promotions gem, but we
    provide a way of syncing that is visible.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a1945a7 View commit details
    Browse the repository at this point in the history
  195. Use ActiveRecord::Migration[7.0]

    Solidus still supports Rails 7.0, and we should, too.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a8ee9b5 View commit details
    Browse the repository at this point in the history
  196. Stop using Adjustment#eligible throughout the gem

    Adjustment#eligible defaults to true, and we never set it to false. It's
    a remnant of the legacy promotion system. I'm also changing the spec
    setup of those specs that indicate ineligible promotion adjustments from
    setting the eligible flag to false to setting the promotion up with an
    impossible condition instead.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3d9e1c9 View commit details
    Browse the repository at this point in the history
  197. Remove promotion_code#adjustments

    This association is not used anywhere in the codebase, and it's probably
    a remnant of adjustments being directly associated with promotion codes.
    
    SolidusLegacyPromotions does this, but we have no need for this, because
    we can just as well join via the `friendly_order_promotions` table.
    An adjustment from a promotion with codes will have one of the promotion
    benefits as a source, and an order_promotion with a reference to the
    promotion code used.
    
    I could have also changed the association to one that follows this path,
    but I'm really not sure what we would use this association for.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    7353bbf View commit details
    Browse the repository at this point in the history
  198. Fix order recalculator spec

    In friendlycart/solidus_friendly_promotions#130,
    we changed the default of
    SolidusFriendlyPromotions.config.sync_order_promotions, but failed to
    adjust this spec accordingly.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e699705 View commit details
    Browse the repository at this point in the history
  199. Fix benefits controller

    In friendlycart/solidus_friendly_promotions#128
    we renamed the config option `actions` to `benefits`, but failed to
    include that renaming in the benefits controller.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    70d29c6 View commit details
    Browse the repository at this point in the history
  200. Use SimpleOrderContents in specs

    In our test suite, we need to have solidus_legacy_promotions loaded.
    This gem sets the `Spree::Config.order_contents_class` to the legacy
    `Spree::OrderContents`, but we need `SimpleOrderContents` so we don't
    run into the legacy promotion system.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    1bb26de View commit details
    Browse the repository at this point in the history
  201. Add Legacy Promotions to Rakefile

    Otherwise we don't load solidus_legacy_promotions, and its migrations
    don't run.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b291164 View commit details
    Browse the repository at this point in the history
  202. Integration spec: Be more explicit about spec setup

    This spec was failing before because the sync option was not set.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    33b1693 View commit details
    Browse the repository at this point in the history
  203. Add TestingSupport::FactoryBot

    This mirrors the setup in Solidus core, and in Solidus Legacy
    Promotions.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    cc011bf View commit details
    Browse the repository at this point in the history
  204. Drop solidus_dev_support dependency

    Solidus core does not depend on solidus_dev_support, so we should not
    either.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4b9b980 View commit details
    Browse the repository at this point in the history
  205. Rollup migrations and change table name prefix

    As preparation for the solidus integration, we don't need to create
    tables and then rename them. Let's rather have them the right name from
    the get-go.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    fb8ddba View commit details
    Browse the repository at this point in the history
  206. Rubocop -a

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    82d9583 View commit details
    Browse the repository at this point in the history
  207. Friendly Promotions: Convert attribute accessor to preference

    This has the same effect and removes a rubocop issue.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e46661f View commit details
    Browse the repository at this point in the history
  208. Configuration menu
    Copy the full SHA
    991ead8 View commit details
    Browse the repository at this point in the history
  209. Prefix associations and factories with solidus_ instead of friendly_

    In the new solidus_promotions gem, we need some way of distinguishing
    factories and associations from the legacy_promotion ones. In
    `solidus_friendly_promotions`, that prefix was `friendly_`, in
    `solidus_promotions`, it's `solidus_`.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    314fffb View commit details
    Browse the repository at this point in the history
  210. Lint ERB

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    7dfec07 View commit details
    Browse the repository at this point in the history
  211. Configuration menu
    Copy the full SHA
    3de5c94 View commit details
    Browse the repository at this point in the history
  212. Adapt gemspec to new home

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c59f5b7 View commit details
    Browse the repository at this point in the history
  213. Remove SolidusPromotions::TestingSupport module

    It's not needed, we have SolidusPromotions::TestingSupport::FactoryBot.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    b7b178c View commit details
    Browse the repository at this point in the history
  214. Spec coverage: Test #level

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    43a9d07 View commit details
    Browse the repository at this point in the history
  215. Move line item comparison hook config to engine

    This will always be available, and users should not configure it.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    029ca96 View commit details
    Browse the repository at this point in the history
  216. Remove unused private method

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    65c6242 View commit details
    Browse the repository at this point in the history
  217. Configuration menu
    Copy the full SHA
    c8c8542 View commit details
    Browse the repository at this point in the history
  218. Move menu code from initializer template to Engine

    If we have this gem loaded, we definitely want it to be visible. We also
    want the menu items to be tested.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d0e4b41 View commit details
    Browse the repository at this point in the history
  219. Test Configuration.configure

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    071040b View commit details
    Browse the repository at this point in the history
  220. Configuration menu
    Copy the full SHA
    6d60035 View commit details
    Browse the repository at this point in the history
  221. Configuration menu
    Copy the full SHA
    f489083 View commit details
    Browse the repository at this point in the history
  222. Spec coverage: Simplify ItemTotal#ineligible_message

    The else case here cannot be reached (I tried), and the case statement
    is repeated in the method below.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    93e8c4a View commit details
    Browse the repository at this point in the history
  223. Spec coverage: Comment out all lines in initializer

    This does not make any difference but gives better stats.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    ababd82 View commit details
    Browse the repository at this point in the history
  224. Configuration menu
    Copy the full SHA
    42d8bd6 View commit details
    Browse the repository at this point in the history
  225. Test updateable conditions

    All of these have no preferences, but associations, and therefore need
    to be updateable.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e7a5f9d View commit details
    Browse the repository at this point in the history
  226. Configuration menu
    Copy the full SHA
    22fe73d View commit details
    Browse the repository at this point in the history
  227. Rename PermissionSet from Friendly to Solidus

    Also fix the spec name so it actually runs.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a12bdf6 View commit details
    Browse the repository at this point in the history
  228. Test promotion codes admin

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    bd1a355 View commit details
    Browse the repository at this point in the history
  229. Rename route scope to solidus

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0229961 View commit details
    Browse the repository at this point in the history
  230. Configuration menu
    Copy the full SHA
    088690a View commit details
    Browse the repository at this point in the history
  231. Rename factory files

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4db86f7 View commit details
    Browse the repository at this point in the history
  232. Rename FriendlyPromotionAdjuster to OrderAdjuster

    This reflects better what it does.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    1ca6fb2 View commit details
    Browse the repository at this point in the history
  233. Fix promotions table filter

    This looked a bit garbled without these extra w-100s.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e0d10ae View commit details
    Browse the repository at this point in the history
  234. Configuration menu
    Copy the full SHA
    996c4e2 View commit details
    Browse the repository at this point in the history
  235. Remove importmap binstub

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    06312f2 View commit details
    Browse the repository at this point in the history
  236. Remove Null Promotion Handler

    Solidus Core now ships with a Null promotion handler.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    7555730 View commit details
    Browse the repository at this point in the history
  237. Adapt README file

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3d89ee3 View commit details
    Browse the repository at this point in the history
  238. Configuration menu
    Copy the full SHA
    44a3a4d View commit details
    Browse the repository at this point in the history
  239. Remove version.rb file

    We'll just be using Spree.solidus_version instead, like all the other
    gems.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    dd6df37 View commit details
    Browse the repository at this point in the history
  240. Namespace JS under backend

    This is to indicate clearly that this JS is used for the backend UI.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    f2bfd06 View commit details
    Browse the repository at this point in the history
  241. LineItemApplicableOrderCondition to LineItemApplicableOrderLevelCondi…

    …tion
    
    This rename is for consistency only.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    eb90119 View commit details
    Browse the repository at this point in the history
  242. Improve error messaging for unimplemented methods on Benefit

    This allows developers to more clearly see what they need to do in order
    to implement custom promotion benefits.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0212f9b View commit details
    Browse the repository at this point in the history
  243. Improve documentation and install generator

    This should give developers better hints as to how to use this gem.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    326f117 View commit details
    Browse the repository at this point in the history
  244. Configuration menu
    Copy the full SHA
    cab3b5e View commit details
    Browse the repository at this point in the history
  245. Lint

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    0136666 View commit details
    Browse the repository at this point in the history
  246. Improve performance of Promo Code Batch Builder

    As pointed out in
    https://github.com/solidusio/solidus/pull/5383/files#r1391519251, the
    new promotion code batch builder had worse performance characteristics
    than the one in the legacy promotion system. This gets the
    characteristics back to those of the legacy promotion system.
    
    Time spent and memory usage still go up significantly and linearly with
    the number of batches. I ran some specs with the following code:
    
    ```rb
      context "with a very large number of promotion codes" do
        let(:number_of_codes) { 10000 }
    
        it "creates the correct number of codes" do
          puts Benchmark.measure { subject.build_promotion_codes }
          expect(promotion.codes.size).to eq(number_of_codes)
        end
      end
    ```
    
    With a 1000 codes, I measured:
    
    ```
    Randomized with seed 49097
      1.036322   0.028977   1.065299 (  1.074396)
    ```
    
    With 10000 codes, I measured:
    
    ```
    Randomized with seed 33250
      9.606364   0.278920   9.885284 (  9.978242)
    ```
    
    Memory usage went up linearly as well.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    675eac0 View commit details
    Browse the repository at this point in the history
  247. Lint promotino map

    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    471db28 View commit details
    Browse the repository at this point in the history
  248. Fix documentation in persist_discounted_order.rb

    Much of this code has been lifted from some tax abstraction in core, and
    some of the comments had not been updated.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4c75a16 View commit details
    Browse the repository at this point in the history
  249. Configuration menu
    Copy the full SHA
    98c7d4f View commit details
    Browse the repository at this point in the history
  250. Fix linting issues

    With the removal of our own .rubocop.yml, a few new linting problems
    appeared.
    mamhoff committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    bf743d2 View commit details
    Browse the repository at this point in the history