QuickBirdEng / survey_kit

Flutter library to create beautiful surveys (aligned with ResearchKit on iOS)
MIT License
127 stars 97 forks source link

Update survey default values with data from DB when filling survey #78

Open VladEfanovNewton opened 2 years ago

VladEfanovNewton commented 2 years ago

Hello I created survey with survey_kit commit: 41f32291e87b4c0e41f75b9d7e6bebaa3723a6c9. At the beginning of the survey, the person's ID is asked. After inserting the person id, I want to check in the DB if the person already exists. If yes, the default survey values will be replaced with the values from the DB. Can I do it and how? Also, I want to log after every step that goes through in the survey. Can I do it and how? Thanks in advance

ezmegy commented 2 years ago

Hey @VladEfanovNewton ,

Pre-loading survey with existing results; I think there are two parts of this: A) you have to persist previous results and B) you'd need to populate the survey object.

Logging: you can only catch navigation events and e.g. log something when those happen (see SurveyController), listening to single user taps (selections of an answer) is not provided by the plugin. I'd start at looking at createView() in question_step.dart: all the different answer view types would probably need to provide an onAnswerChanged() or similar callback that you can then use at QuestionStep level... It would be certainly more effort to implement than the previous point.

Both features would be very nice to have though so consider opening separate new tickets for enhancement.

ayushin commented 2 years ago

Very much interested to see B) implemented. @adar2378

adar2378 commented 2 years ago

@Numoy Any plan for this? We would also like to prefill the survey with previously completed results from the user.

Numoy commented 1 year ago

I will try to integrate this with the next feature release!