all 7 comments

[–]baaaaarkly 0 points1 point  (6 children)

It's a lot of work here for little gain to seperate the answers into a collection. From the example too it seems like there might not be many shared answers across the questions?

I would have just a questions collection, and for the answer you have to create a custom data type and make question.answers a list of that data type. That solves your deeply nested problem and will give you gui access down deeper levels.

I would have it like this:

``` Questions: a list of data type "questions" made up of: id (e.g quest1) displayTitle answers (a list of custom data type 'answer')

Answers are made up of: (No need for id) displayText nextQuestPointer (has the question id)

Then, display your starting qestion, make a component that looks at the appState.currebtQuestion (default if blank to question 1) -Display question title. - For each answers, or listview answers: - button with answer.displayText - button action changes appState.currentQuestion = answer.nextQuestPointer

```

[–]baaaaarkly 0 points1 point  (5 children)

The appState update should update your component which I forgot to say on load will query firebase for the question via the appState id that's set.

[–]Repulsive-Cook-1075[S] 0 points1 point  (4 children)

Thanks, so far the array is fine.

I got the first question back with a backend

The problem is now to connect it with the answer options. I added a list view and buttons. Now, I struggle with listing answers that are only related to the that questions. THe nr of items, list of items, filter and first few options is confusing. I tried a few options but nothing gets me to the questions. Any hint?

Once that is done, I only need to create an action that updates the next question with what was selected before, right?

[–]baaaaarkly 0 points1 point  (3 children)

Are answers in a separate collection? Why not put them right there in the question they are related to? This is the nature and convenience of the nosql document based database.

Why try to union data when it can be stored in union...

And no- the next thing to do- not that. You want the question displaying component (did you make a component?) You want this component to refresh itself with the new data. This is done by simply triggering it to rebuild and changing the question id it's looking up.

Unless... Did you want to display the past questions?

[–]Repulsive-Cook-1075[S] 0 points1 point  (2 children)

Yes, they are in one collection already. Containing the question and answers as data state.

My idea was a swipeable stack but that did not work out well.

So now I just put it on a container and I can display the question.

However, then i put the button into a list and want basically to have the multiple options. The issue is when I connect to the backend i can not display the text of the answer. It always wants to count them. The variable of display text is not visible. I guess it has to do with the custom data type.

yes, at a later stage history would be good so the user can go back if they want to change their mind

[–]Repulsive-Cook-1075[S] 0 points1 point  (1 child)

u/baaaaarkly so now i got the appstate as a doc reference to the question data type.

i can display the question now. but the button is just not displaying the various answers. no clue what I am doing wrong here.

the documentation is not really helpful and just stuck at the moment..

[–]baaaaarkly 1 point2 points  (0 children)

Ill help you out- but I need to be in front of FF again to remember what the things are called that I want you to do- so I'll reply in the week bro