-
Notifications
You must be signed in to change notification settings - Fork 7
How to get average
The DB has a lot of inputs from several users and some inputs belong to the same user. The main functions to obtain the average are in statsFunctions.js
-
Many inputs belong to same user, so there is need to calculate the averages of the average. Therefore we find two
for
loop cycles. The i cycle refers to a matrix with unique user ids for the specific country, while the j cycle refers to a matrix with all the information provided on the DB for that specific country; -
It is checked if the entry does not come from a spam-bot. Therefore the first input from the user, must be greater than MIN_TIME_TO_FILL_FORM, considering spam-bots tend to fill the forms in very quickly. The threshold was given through analysis of the respective chart;
-
Then, the calculation is made using the function calculate_costs from coreFunctions.js;
-
The average of the averages is calculated and the result is outputted.
Array A on the left represent unique users (i loop) while array B on the right (j loop) has all the information.