ahmedheakl/shopping_system_ui

Feedback on the assignment

Opened this issue · 0 comments

Cart

  • ✅ Must include ItemManager
  • ✅ Must include Ownable
  • ✅ Must have an @owner
  • ✅ To have @Items
  • ✅ To return @Items (overriding ItemManager#items)
  • ✅ to be stored in @Items
  • ✅ To return the sum of the prices of the Item objects stored in @Items
  • ❌ The purchase amount of all items in the cart (Cart#items) should be transferred from the wallet of the cart owner to the wallet of the item owner.
  • ✅ The owner rights of all items in the cart (Cart#items) should be transferred to the owner of the cart.
  • ✅ The contents of the cart (Cart#items) must be empty

Customer

  • ✅ Must inherit from User
  • ✅ Must have @cart with itself as the owner
  • ✅ should return a Cart object with itself as owner
  • ✅ '#cart=' must not be defined (using attr_reader)

ItemManager

  • ✅ should return all items for which it is the owner
  • ✅ To return items according to the item number (number) and quantity (quantity)

If a non-existent item number is specified

  • ✅ to return nil

If the number of items is greater than or equal to the number of items you own

  • ✅ should return nil
  • ❌ To display a list of items owned by the user and their quantity, categorized by label.

Item

  • ✅ Must include Ownable
  • ✅ Must have @@instances
  • ✅ @@instances must be an array
  • ✅ Must have an @name
  • ✅ To have @price
  • ✅ To have @owner
  • ✅ To store itself in @@instances
  • ✅ To return the string defined in the name attribute
  • ✅ '#name=' must not be defined (using attr_reader)
  • ✅ To return the number defined in the price attribute
  • ✅ '#price=' must not be defined (using attr_reader)
  • ✅ Must return a hash of { name: its own name, price: its own price }
  • ✅ Return @@instances (return all instantiated Item objects)

Seller

  • ✅ User must be inherited.

User

  • ✅ must include ItemManager
  • ✅ Must have @name
  • ✅ must have @wallet with itself as the owner
  • ✅ To return the string defined in the name attribute
  • ✅ that we can change name
  • ✅ should return a Wallet object with itself as the owner
  • ✅ '#wallet=' must not be defined (using attr_reader)

Wallet

  • ✅ must include Ownable
  • ✅ To have @owner
  • ✅ Must have @balance with initial value of 0
  • ✅ To return the number defined in the balance attribute
  • ✅ '#balance=' must not be defined (using attr_reader)
  • ✅ that the number passed as "amount" will be added to its own balance
  • ✅ subtract the number passed as "amount" from its own balance and return that number

If there is not enough balance

  • ✅ to return nil