1- # """Functions to manage a users shopping cart items."""
2- #
3- #
4- # def add_item(current_cart, items_to_add):
5- # """Add items to shopping cart.
6- #
7- # :param current_cart: dict - the current shopping cart.
8- # :param items_to_add: iterable - items to add to the cart.
9- # :return: dict - the updated user cart dictionary.
10- # """
11- #
12- # pass
13- #
14- #
15- # def read_notes(notes):
16- # """Create user cart from an iterable notes entry.
17- #
18- # :param notes: iterable of items to add to cart.
19- # :return: dict - a user shopping cart dictionary.
20- # """
21- #
22- # pass
23- #
24- #
25- # def update_recipes(ideas, recipe_updates):
26- # """Update the recipe ideas dictionary.
27- #
28- # :param ideas: dict - The "recipe ideas" dict.
29- # :param recipe_updates: dict - dictionary with updates for the ideas section.
30- # :return: dict - updated "recipe ideas" dict.
31- # """
32- #
33- # pass
34- #
35- #
36- # def sort_entries(cart):
37- # """Sort a users shopping cart in alphabetically order.
38- #
39- # :param cart: dict - a users shopping cart dictionary.
40- # :return: dict - users shopping cart sorted in alphabetical order.
41- # """
42- #
43- # pass
44- #
45- #
46- # def send_to_store(cart, aisle_mapping):
47- # """Combine users order to aisle and refrigeration information.
48- #
49- # :param cart: dict - users shopping cart dictionary.
50- # :param aisle_mapping: dict - aisle and refrigeration information dictionary.
51- # :return: dict - fulfillment dictionary ready to send to store.
52- # """
53- #
54- # pass
55- #
56- #
57- # def update_store_inventory(fulfillment_cart, store_inventory):
58- # """Update store inventory levels with user order.
59- #
60- # :param fulfillment cart: dict - fulfillment cart to send to store.
61- # :param store_inventory: dict - store available inventory
62- # :return: dict - store_inventory updated.
63- # """
64- #
65- # pass
66- """Functions to manage a users shopping cart items."""
67-
681"""Functions to manage a users shopping cart items."""
692
703
@@ -76,11 +9,7 @@ def add_item(current_cart, items_to_add):
769 :return: dict - the updated user cart dictionary.
7710 """
7811
79- for item in items_to_add :
80- current_cart .setdefault (item , 0 )
81- current_cart [item ] += 1
82-
83- return current_cart
12+ pass
8413
8514
8615def read_notes (notes ):
@@ -90,7 +19,7 @@ def read_notes(notes):
9019 :return: dict - a user shopping cart dictionary.
9120 """
9221
93- return dict . fromkeys ( notes , 1 )
22+ pass
9423
9524
9625def update_recipes (ideas , recipe_updates ):
@@ -101,8 +30,7 @@ def update_recipes(ideas, recipe_updates):
10130 :return: dict - updated "recipe ideas" dict.
10231 """
10332
104- ideas .update (recipe_updates )
105- return ideas
33+ pass
10634
10735
10836def sort_entries (cart ):
@@ -112,7 +40,7 @@ def sort_entries(cart):
11240 :return: dict - users shopping cart sorted in alphabetical order.
11341 """
11442
115- return dict ( sorted ( cart . items ()))
43+ pass
11644
11745
11846def send_to_store (cart , aisle_mapping ):
@@ -122,12 +50,8 @@ def send_to_store(cart, aisle_mapping):
12250 :param aisle_mapping: dict - aisle and refrigeration information dictionary.
12351 :return: dict - fulfillment dictionary ready to send to store.
12452 """
125- fulfillment_cart = {}
12653
127- for key in cart .keys ():
128- fulfillment_cart [key ] = [cart [key ]] + aisle_mapping [key ]
129-
130- return dict (sorted (fulfillment_cart .items (), reverse = True ))
54+ pass
13155
13256
13357def update_store_inventory (fulfillment_cart , store_inventory ):
@@ -138,9 +62,4 @@ def update_store_inventory(fulfillment_cart, store_inventory):
13862 :return: dict - store_inventory updated.
13963 """
14064
141- for key , values in fulfillment_cart .items ():
142- store_inventory [key ][0 ] = store_inventory [key ][0 ] - values [0 ]
143- if store_inventory [key ][0 ] == 0 :
144- store_inventory [key ][0 ] = 'Out of Stock'
145-
146- return store_inventory
65+ pass
0 commit comments