H
H
hardwellZero2018-08-16 21:35:03
Database
hardwellZero, 2018-08-16 21:35:03

How to store data for cost calculator?

Hello.
It is necessary to implement a cost calculator on the site, the user chooses what "chips" he needs and receives the cost of his project.
The main problem is that there are a lot of scripts for the user.
For example:
1. Chose that he needs object A (from A, B, C)
2. Since he chose A, then give A1,A2,A3 ... A10
to choose from 3. If he chose A3 or A4, then give A3.1 to choose /A3.2 or A4.1/A4.2
etc.
The question is that I don’t know how to properly store all these links between objects, now from the customer I only have a google sheet with possible scenarios for the user, and there are a lot of them (> 150).
UPD. I found a site with similar logic only for development evaluation
https://estimatemyapp.com/
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2018-08-16
@xmoonlight

1. We make an array of UNIFIED "pages" (steps) of the entire form.
2. Make an array of UNIFIED TRANSITIONS: the id of the unified "page", the state of the fields (+calculation), the id of the next "page" (to which we will redirect after filling this one correctly).
3. You need to make a function like a switch and a loop. That is, we make conditions and what to show.
There is no "Completed" flag in the form - a cycle in a circle, otherwise - exit from the function.
In the conditions - we prescribe: which "page" of the survey to display on the current state of filling in the entire form and the ID of the unified transition (selecting the next one along with the calculation depending on the filling of the current one).
Also, you can make nested conditions through recursion:
At the end, we get everything we need.

D
Dmitry Shitskov, 2018-08-16
@Zarom

You can try using Postgresql and ltree .
Judging by conditions of your task - quite applicable method of storage and processing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question