Booking items - load speed issues

Hello guys,

So I’m making an app where a user can book particular number of items from particular category (ex. boat) and subcategory (ex. size) of products. I have some issues with loading speed.

  • User want to see only category and subcategory with available products
  • User want to book particular number of products in particular subcategory but only to the maximum available
  • Admin wants to receive order with info on category, subcategory of products and amount and than assign particular items to the order.

My solution for this stuff is to define few related database:
→ Category (with description)
→ Subcategory
→ items

When order is made I create a thing “booking” with following fields:

  • category
  • subcategory (ex. size)
  • amount
  • total price
  • start of booking
  • end of booking

Now the issue is to show available amount of products in particular “category” and “subcategory”.

I’ve made an RG in RG:

  • Parent RG → category with description and price
  • Child RG → subcategory (size)
  • in child RG → amount of items available in chosen time period.

Now to show particular parent RG and Child RG I check the total number of items - sum of amount in bookings (filtered to chosen category / subcategory and selected time period). Same formula is used to calculate available amount. The problems is that it is extreamly slow and I need to make those same computations 3 times to show:

  • Available categories
  • Available subcategories
  • Amount available.

In coding world I would have just one request returning me just one JSON which I will use to construct repeating group, but here I’m making 3 requests instead for each case.

Do you know any solution to this? How can simplify it and speed up?

Hello, I believe that the first step would be to create a list of subcategories in the categories, only then, you already solve the display part to make only one request, referring to the quantity, as the subcategory already has the quantity of items of that product, it becomes easier check whether or not the value is greater than what is available.

If I understand correctly, this should do the trick

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