-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#161847] Rake tasks for adding new PriceGroups to ScheduleRules (#3594)
# Release Notes When a global price group is created, it needs to be added to all the schedule rules for it to appear on the UI for each product. This created a rake tasks which does that.
- Loading branch information
Showing
7 changed files
with
101 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :price_group do | ||
# This creates a new global price group, if it does not exist, and adds | ||
# a PriceGroupDiscount for it to every ScheduleRule. If the price group | ||
# already exists, this will just add PriceGroupDiscounts for it to ScheduleRules | ||
# that are missing then. | ||
# | ||
# rake price_group:add_global_price_group["new group",true,false,15] | ||
desc "Create a new global price group and/or setup schedule rules for it" | ||
task :add_global_price_group, [:name, :internal, :admin_editable, :discount] => :environment do |_t, args| | ||
name = args[:name] | ||
is_internal = args[:internal].casecmp("true").zero? | ||
admin_editable = args[:admin_editable].casecmp("true").zero? | ||
discount_percent = args[:discount] || 0 | ||
|
||
PriceGroup.setup_global(name:, is_internal:, admin_editable:, discount_percent:) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters