Conditions not working as expected for Adding/Removing product from Cart


I am trying to build an application in which food ordering is required. I had built it earlier but made a few changes later on to make it better and I seem to somehow have broken it.
It is not working as expected. I have added the link to the editor here:

Let me highlight the issue here,

When I add an item to the cart, the items get added twice.

The conditions that are placed to make the adding and removing work correctly are not behaving as expected.

For example,

  1. The first step in the “Add” button workflow, is to check if the user has a current_food_oder_cart and if not, create one. This condition is evaluating to false when it should evaluate to True because there is no data in the cart table.
  2. This seems to be starting point of all trouble and all other conditions are also not behaving as they should. The app data clearly suggests otherwise but in the workflow, the conditions are not working as expected.
  3. The quantity also seems to first be 3 but after refreshing the page, the quantity goes down to 2.

I have added a text box to debug the issue and view food cart.

I have created a separate app for this bug so it is very minimal. Request you to please help in figuring out the issue here.

This topic was automatically closed after 70 days. New replies are no longer allowed.