Make a random question list without showing answered questions

Hello!

I’m breaking my head about finding a way to build a test app that shows random questions but with an option to not show questions that the user has already answered (answers saved on Firebase of course).

Thanks in advance…

create 2 columns in your database:

  1. n_ans number of times this question has been answered
  2. n_ans_ok number of times this question has been answered correctly.
    make sure to update these 2 fields immediately after an answer is made to a presented question.

create a subroutine, getQList which returns a list of row_numbers, or row_id or some field that makes the question unique and can be used for obtaining a row from the database. allow 2 input parameters:

  1. filter_option (1=yes apply filter; 0=no, do not apply any filter , ignore filter_type)
    2 filter_type
  • 0 means n_ans is equal to zero
  • 1 means n_ans equals n_ans_ok,
  • 2 means n_ans greater than n_ans_ok

create the list of questions by calling getQList with the desired combination of filter_option and filter_type
randomize the list
iterate over the list - for each entry, obtain the corresponding row from table and present each question, ask for answer, update table.

Have to admit that I got a little confused with it. I sharpen the question a bit.
It’s going to be a personality test so there are no right or wrong answers.
I just want the answered questions that had been sent to firebase to not appear again (unless a toggle is on).

If so, do I still need the second column or just one column enough?
I am currently taking the questions from the locale db - I did not understand where I should put them now …

Thank you!

you’re right - you don’t need the 2nd column. you may not need the 2 parameters in the subroutine anymore. but you may want to replace them with one global variable to indicate (apply filter or not) and if filter is to be applied, you only need to check n_ans is zero or greater_than_zero.
the local db can contain your whole test. or you can store it in airtable, or firebase. you need the ability to help you get a specific record directly by using its “key” field.

I Used those blocks to create a folder in the realtime DB

and used this block to create get a random number that will be compared to the ones in the first blocks.

I have tried dozens of ways to pull data from the DB and if the information does not exist to create the requested functionality, but nothing works :frowning:

Could you please explain to me in detail how to do it?
I’m pretty sure there is a smarter easier way to do this function.

thank you so much!