Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Example | ||
@model = FactoryGirl.create(:model, product: 'Example Model') | ||
@pool = FactoryGirl.create(:inventory_pool) | ||
|
||
@inventory_manager = FactoryGirl.create(:inventory_manager, | ||
inventory_pool: @pool, | ||
email: 'inventory_manager@example.com') | ||
|
||
4.times { FactoryGirl.create(:item, model: @model, inventory_pool: @pool) } | ||
|
||
@group_1 = FactoryGirl.create(:group, inventory_pool: @pool, name: 'Group 1') | ||
@group_2 = FactoryGirl.create(:group, inventory_pool: @pool, name: 'Group 2') | ||
|
||
FactoryGirl.create(:entitlement, model: @model, entitlement_group: @group_1, quantity: 2) | ||
FactoryGirl.create(:entitlement, model: @model, entitlement_group: @group_2, quantity: 1) | ||
|
||
@user_A = FactoryGirl.create(:customer, inventory_pool: @pool, email: 'user_a@example.com', | ||
firstname: 'User', lastname: 'A') | ||
@group_1.users << @user_A | ||
@group_2.users << @user_A | ||
|
||
@user_B = FactoryGirl.create(:customer, inventory_pool: @pool, email: 'user_b@example.com', | ||
firstname: 'User', lastname: 'B') | ||
@group_2.users << @user_B | ||
|
||
@user_C = FactoryGirl.create(:customer, inventory_pool: @pool, email: 'user_c@example.com', | ||
firstname: 'User', lastname: 'C') | ||
|
||
# Timecop.travel('2018-06-27') # personas travel date | ||
|
||
@r1 = FactoryGirl.create(:reservation, model: @model, status: :approved, user: @user_A, inventory_pool: @pool, | ||
start_date: Date.parse('2018-06-26'), end_date: Date.parse('2018-07-05')) | ||
@r2 = FactoryGirl.create(:reservation, model: @model, status: :approved, user: @user_B, inventory_pool: @pool, | ||
start_date: Date.parse('2018-06-27'), end_date: Date.parse('2018-06-28')) | ||
@r3 = FactoryGirl.create(:reservation, model: @model, status: :approved, user: @user_C, inventory_pool: @pool, | ||
start_date: Date.parse('2018-06-27'), end_date: Date.parse('2018-07-11')) | ||
@r4 = FactoryGirl.create(:reservation, model: @model, status: :approved, user: @user_A, inventory_pool: @pool, | ||
start_date: Date.parse('2018-07-02'), end_date: Date.parse('2018-07-03')) | ||
end |
7 changes: 7 additions & 0 deletions
7
sources/business_logic/availability_example/hard_overbooking.rb
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,7 @@ | ||
module Example | ||
@model.items.take(2).each do |i| | ||
i.update_attributes! \ | ||
retired: Date.today, | ||
retired_reason: Faker::Lorem.sentence | ||
end | ||
end |
Binary file added
BIN
+102 KB
sources/business_logic/availability_example/hard_overbooking_timeline.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
sources/business_logic/availability_example/soft_overbooking.rb
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,4 @@ | ||
module Example | ||
@r5 = FactoryGirl.create(:reservation, model: @model, status: :approved, user: @user_C, inventory_pool: @pool, | ||
start_date: Date.parse('2018-07-10'), end_date: Date.parse('2018-07-11')) | ||
end |
Binary file added
BIN
+105 KB
sources/business_logic/availability_example/soft_overbooking_timeline.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+63.9 KB
sources/business_logic/availability_example/user_b_booking_calendar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.