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

Donte Handy #15

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
df476bf
Add author name to README
dontehandy Jan 15, 2025
c43477f
Add contact number to README
dontehandy Jan 15, 2025
f4799ee
Merge pull request #1 from dontehandy/test1
dontehandy Jan 15, 2025
d096e32
Add initial item spec file
dontehandy Jan 15, 2025
616b92e
Add RSpec configuration and SimpleCov setup for test coverage
dontehandy Jan 15, 2025
fda4d30
Add FoodTruck class with inventory management methods
dontehandy Jan 15, 2025
d408a6a
Add check_quantity method to FoodTruck class and corresponding specs
dontehandy Jan 15, 2025
752a05c
Add inventory reporting test and require spec_helper in specs
dontehandy Jan 15, 2025
013d4a9
Add Event class with methods for managing food trucks and their inven…
dontehandy Jan 15, 2025
331d173
Add potential_revenue method to FoodTruck class and corresponding specs
dontehandy Jan 15, 2025
68ea01d
Remove check_quantity method and related tests from FoodTruck class
dontehandy Jan 15, 2025
a4e5d08
Refactor food_truck_names method to use block syntax for clarity
dontehandy Jan 15, 2025
6eb6b07
Add new methods to Event class for inventory management and reporting
dontehandy Jan 15, 2025
05aa554
Update coverage timestamps in resultset.json and index.html
dontehandy Jan 15, 2025
b161334
Update coverage reports and add stock for new item in event tests
dontehandy Jan 15, 2025
c6eb8ea
Add test interactions for FoodTruck and Event classes
dontehandy Jan 15, 2025
74b3c25
Refactor sorted_item_list method for improved clarity and update spec…
dontehandy Jan 15, 2025
20535f8
Update coverage timestamps and adjust line counts in resultset.json
dontehandy Jan 15, 2025
a644b72
Remove test_interaction.rb file as it is no longer needed
dontehandy Jan 15, 2025
23b913d
Update README.md with examples for Event and FoodTruck classes
dontehandy Jan 15, 2025
c2a1b19
Update coverage timestamps in resultset.json and index.html
dontehandy Jan 15, 2025
3f8a4a2
Add attribute comments to FoodTruck and Item classes for clarity
dontehandy Jan 15, 2025
86051a0
Add comments to FoodTruck class methods for better understanding
dontehandy Jan 15, 2025
8a36cf1
Add comments to stock method in FoodTruck class for clarity
dontehandy Jan 15, 2025
f8baee2
Add comments for clarity in Event and FoodTruck classes; enhance Food…
dontehandy Jan 15, 2025
6a2756a
Update coverage data in resultset.json with new line counts and times…
dontehandy Jan 15, 2025
a54af5c
Update coverage data and enhance event specs with additional inventor…
dontehandy Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 100 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Food Truck Event

Donte Handy
123

## Instructions

* Fork this Repository
Expand Down Expand Up @@ -172,7 +175,6 @@ pry(main)> food_truck3.potential_revenue

Use TDD to update the `Event` class so that it adds the following functionality. You need to complete at least 2 of the 3 methods in Iteration 3 to pass, as well as all of Iteration 1 and 2.


1. An `Event` can return a list of *names* of all items the `FoodTrucks` have in stock, sorted alphabetically. This list should not include any duplicate items.
1. An `Event` can return a hash of total inventory that reports the available inventory of all items sold at the event. Specifically, it should include:
- All items available for sale, and each item should identify the total inventory/quantity for that item, as well as a list of `FoodTruck`s that sell that item.
Expand All @@ -182,7 +184,7 @@ Use TDD to update the `Event` class so that it adds the following functionality.
| ------------------------- | ---------------------------
| `sorted_item_list` | Alphabetically sorted `Array` of all `FoodTruck` item <u>names</u> (no duplicates!). Array of Strings.
| `total_inventory` | `Hash` with `Item`s as keys and a sub-hash as the value. The sub-hash should have `quantity` and `food_trucks` keys.(See example below)
| `overstocked_items` | `Array` of `Item` objects
| `overstocked_items` | `Array` of `Item` objects

```ruby
# event.total_inventory
Expand All @@ -204,6 +206,102 @@ Use TDD to update the `Event` class so that it adds the following functionality.
# }
```

```ruby
pry(main)> event.sorted_item_list
#=> ["Apple Pie (Slice)", "Banana Nice Cream", "Peach Pie (Slice)", "Peach-Raspberry Nice Cream"]

pry(main)> event.total_inventory
#=> {
# #<Item:0x007f9c56740d48...> => {
# quantity: 100,
# food_trucks: [#<FoodTruck:0x00007fe1348a1160...>, #<FoodTruck:0x00007fe134910650...>]
# },
# #<Item:0x007f9c565c0ce8...> => {
# quantity: 50,
# food_trucks: [#<FoodTruck:0x00007fe1349bed40...>]
# }
# }

pry(main)> event.overstocked_items
#=> [#<Item:0x007f9c56740d48...>]
```

pry(main)> require './lib/item'
#=> true

pry(main)> require './lib/food_truck'
#=> true

pry(main)> require './lib/event'
#=> true

pry(main)> event = Event.new("South Pearl Street Farmers Market")
#=> #<Event:0x00007fe134933e20...>

pry(main)> item1 = Item.new({name: 'Peach Pie (Slice)', price: "$3.75"})
#=> #<Item:0x007f9c56740d48...>

pry(main)> item2 = Item.new({name: 'Apple Pie (Slice)', price: '$2.50'})
#=> #<Item:0x007f9c565c0ce8...>

pry(main)> item3 = Item.new({name: "Peach-Raspberry Nice Cream", price: "$5.30"})
#=> #<Item:0x007f9c562a5f18...>

pry(main)> item4 = Item.new({name: "Banana Nice Cream", price: "$4.25"})
#=> #<Item:0x007f9c56343038...>

pry(main)> food_truck1 = FoodTruck.new("Rocky Mountain Pies")
#=> #<FoodTruck:0x00007fe1348a1160...>

pry(main)> food_truck1.stock(item1, 35)

pry(main)> food_truck1.stock(item2, 7)

pry(main)> food_truck2 = FoodTruck.new("Ba-Nom-a-Nom")
#=> #<FoodTruck:0x00007fe1349bed40...>

pry(main)> food_truck2.stock(item4, 50)

pry(main)> food_truck2.stock(item3, 25)

pry(main)> food_truck3 = FoodTruck.new("Palisade Peach Shack")
#=> #<FoodTruck:0x00007fe134910650...>

pry(main)> food_truck3.stock(item1, 65)

pry(main)> event.add_food_truck(food_truck1)

pry(main)> event.add_food_truck(food_truck2)

pry(main)> event.add_food_truck(food_truck3)

pry(main)> event.sorted_item_list
#=> ["Apple Pie (Slice)", "Banana Nice Cream", "Peach Pie (Slice)", "Peach-Raspberry Nice Cream"]

pry(main)> event.total_inventory
#=> {
# #<Item:0x007f9c56740d48...> => {
# quantity: 100,
# food_trucks: [#<FoodTruck:0x00007fe1348a1160...>, #<FoodTruck:0x00007fe134910650...>]
# },
# #<Item:0x007f9c565c0ce8...> => {
# quantity: 7,
# food_trucks: [#<FoodTruck:0x00007fe1348a1160...>]
# },
# #<Item:0x007f9c562a5f18...> => {
# quantity: 25,
# food_trucks: [#<FoodTruck:0x00007fe1349bed40...>]
# },
# #<Item:0x007f9c56343038...> => {
# quantity: 50,
# food_trucks: [#<FoodTruck:0x00007fe1349bed40...>]
# }
# }

pry(main)> event.overstocked_items
#=> [#<Item:0x007f9c56740d48...>]


## Iteration 4 - Selling Items

Use TDD to update the `Event` class so that it adds the following functionality:
Expand Down
6 changes: 6 additions & 0 deletions coverage/.last_run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"result": {
"line": 100.0,
"branch": 100.0
}
}
171 changes: 171 additions & 0 deletions coverage/.resultset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
{
"RSpec": {
"coverage": {
"/Users/dontehandy/turing_work/1mod/independent_challenges/turbo-enigma/lib/item.rb": {
"lines": [
null,
null,
1,
1,
null,
1,
65,
65,
null,
null,
null,
null
],
"branches": {}
},
"/Users/dontehandy/turing_work/1mod/independent_challenges/turbo-enigma/lib/food_truck.rb": {
"lines": [
null,
null,
1,
1,
null,
1,
34,
34,
null,
null,
1,
5,
null,
null,
1,
25,
null,
null,
1,
4,
null,
null
],
"branches": {}
},
"/Users/dontehandy/turing_work/1mod/independent_challenges/turbo-enigma/lib/event.rb": {
"lines": [
null,
null,
1,
1,
null,
1,
9,
9,
null,
null,
1,
23,
null,
null,
1,
4,
null,
null,
1,
3,
null,
null,
1,
8,
null,
null,
1,
12,
4,
12,
12,
12,
null,
null,
4,
null,
null,
1,
7,
null,
null
],
"branches": {}
},
"/Users/dontehandy/turing_work/1mod/independent_challenges/turbo-enigma/spec/food_truck_spec.rb": {
"lines": [
1,
null,
1,
1,
7,
7,
7,
7,
7,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
null,
null,
1,
1,
1,
1,
null,
1,
1,
null,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
null,
null,
1,
1,
null,
null
],
"branches": {}
},
"/Users/dontehandy/turing_work/1mod/independent_challenges/turbo-enigma/spec/item_spec.rb": {
"lines": [
1,
null,
1,
1,
1,
null,
1,
1,
1,
null,
null
],
"branches": {}
}
},
"timestamp": 1736967183
}
}
Empty file added coverage/.resultset.json.lock
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions coverage/assets/0.13.1/application.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions coverage/assets/0.13.1/application.js

Large diffs are not rendered by default.

Binary file added coverage/assets/0.13.1/colorbox/border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.13.1/colorbox/controls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.13.1/colorbox/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.13.1/favicon_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.13.1/favicon_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.13.1/favicon_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.13.1/loading.gif
Binary file added coverage/assets/0.13.1/magnify.png
Loading