nimblehq / nimble-survey-web

Nimble Survey API for Mobile Challenge and Certification
0 stars 3 forks source link

[#80] Fix: Wrong validating logic for the submit survey responses API #82

Closed suho closed 1 year ago

suho commented 1 year ago

What happened 👀

For the submitting survey responses API, with our validating logic, we did not allow submitting questions with different orders. I updated the logic to support it.

Insight 📝

The order of array when using intersection can affect the result.

(a & b) == b is different with (b & a) == b

Proof Of Work 📹

When I added tests with questions that have different orders:

Screenshot 2023-01-13 at 14 26 40

All tests are passed:

Screenshot 2023-01-13 at 14 58 14