instedd / surveda

InSTEDD Surveda
https://instedd.org/technologies/surveda-mobile-surveys/
GNU General Public License v3.0
16 stars 6 forks source link

Sample upload should be transactional #2322

Open matiasgarciaisaia opened 2 months ago

matiasgarciaisaia commented 2 months ago

We've detected some issues when uploading large samples into production (see #2268, but we've already did some work on streaming) that makes the respondent group get out of sync with the actual respondents.

Specifically, uploading a sample with 92155 respondents yielded a DBConnection.ConnectionError in the app, and left the database with only 82000 respondents created - but no error to the user in the UI, and Surveda keeps saying the sample includes 92155 respondents.

Screenshot 2024-04-16 at 2 58 33 PM

Screenshot 2024-04-16 at 3 00 11 PM

Apart from actually being able to upload a large sample, we should make Surveda handle this transactionally: if Surveda doesn't create all the respondents in the sample, it should fail and not show the respondent group as having more respondents than it actually has.

This is currently happening at 0.37.2

matiasgarciaisaia commented 2 months ago

The user actually gets an error in the UI when the upload fails, but it's not at all descriptive - it's a generic JSON parsing error, probably due to Surveda trying to JSON-parse a response that's actually an plain-text error message.