WZYCX / RSStodge-STUDENT

Files for Rugby School Stodge Application
2 stars 0 forks source link

count of item is not updated globally #18

Closed WZYCX closed 1 year ago

WZYCX commented 2 years ago

When adding 1 to item.count, the count is not saved after you change to a different page

WZYCX commented 1 year ago

therefore price is not incremented

WZYCX commented 1 year ago

Screenshot 2023-01-15 at 13 57 02

WZYCX commented 1 year ago

SOLVED since the 'item.count' was not referencing the item in basket but the item that was 'iteminbasket'

' for (pos, purchased) in basket.currentBasket.enumerated() { if purchased.name == item.name { basket.currentBasket[pos].count -= 1 // adds one to the count of item in basket } } '