Open kaligrafy opened 2 years ago
For exclusive conditional, the randomProbability could be number | [number, number]
. In the first case, the number is the probability to get the random widget. In the second, it is a start/end range between 0 and 1. For example if 50% of hh should get q1 and the other 50% q2, q1 would have [0, 0.5]
and q2 would have [0.5, 1]. I wouldn't be sure how to handle 0, 0.5 and 1 though... Inclusive or exclusive? If inclusive, 0.5 would get both... Maybe [{value: number, inc: boolean},{value: number, inc: boolean}]
?
Anyway, this will require the random values to be kept in a specific path in the responses. This will also be necessary to be able to set the sampling value when in development mode (see https://github.com/chairemobilite/od_mtl_2023/issues/411)
But implementing this will greatly reduce the burden of survey developers in the future for such questions.
Example: if randomProbability = 0.25 and randomObjectPath = "household.persons.{_activePersonId}", for this person, the widget should appear 25% of the time, but the decision to make it appear or not should be set only once for the person object. Another example: if randomProbability = 0.33 and randomObjectPath = "household" but the widget path is for a person, the widget should appear for 33% of the households, but if it appear, it should for every household members.