Content

Introduction

Once the user is logged and has chosen the products he/she want to buy, and having added his/her location, the web app will send the request to the microservice, to compare the prices and locations of the available supermarkets, and will show to the user the best purchase option.

There are two types of product comparison and ways to buy:

In addition to this, the microservice will provide to the frontend a list of the products and all the supermarkets that offer it, with their price, for later comparison.

All in one

Is selected the cheapest supermarket that offers all the products. If there are two or more supermarkets with the same total price, the one closest to the user will be chosen.

If there isn't any supermarket with all the requested products, is selected the supermarket that offers the most number of requested products.

Cheapest

In this case, the cheapest products are shown by supermarket, distributing all the products among the selected supermarkets. If the user decides this option, a purchase will be generated for each supermarket he or she have chosen.

Comparator Algorithm

The algorithm that the microservice uses makes the comparisons as follows:

Initial phase