neilhpatel / CodeATale

This is the repository for my Junior Design project. My team developed an interactive web application for children to read the story Dr. Dolittle while improving comprehension skills through quizzes and audio.
0 stars 0 forks source link

add quiz queue to database #119

Closed jyun261 closed 2 years ago

jyun261 commented 2 years ago

Pretty self-explanatory. I tried to lessen the amount of reads and writes to the database as much as I could, and the quiz script is the only one where I feel like optimizations could be made (although not likely). I also added a method to the chapter-select.js script to see if the user has been added to the database and adds a new account if they haven't. I will add the bookmark data to the database with a different PR. I also got rid of the annoying screen flickering by making the code get the queue data after everything else has been loaded in (although we could still optimize how the screen looks when it flickers by removing the help button and things like that).

Just try to mess with it as much as you can to see if the quiz queue ever gets messed up and lmk.

Also, I figured out how to create subcollections within documents so the structure of the database hasn't changed.

Btw Neil the Codacy errors involve variables being used before they are instantiated; however, the code still works fine and I did it this way so that the rest of the javascript file can get run before fetching the queue from the database and the speedup from this change is significant. Also, it's fine because queue is only used in click events and so queue will only be needed if the button is clicked on. So you can compare if you want, but I think it's better to let the codacy errors slide.

jyun261 commented 2 years ago

Yeah Neil, I'm not sure how hard getting rid of the flickering will be. I will try and look into it though.

Also, I think you're going to have to override the codacy errors.

jyun261 commented 2 years ago

Ok Neil, I just fixed the issue where the prevButton shows for a second on load.

neilhpatel commented 2 years ago

Ok Neil, I just fixed the issue where the prevButton shows for a second on load.

Shouldn't we also do the same thing for the nextPg button? Because if there is only 1 quiz in the queue, the next pg icon should not automatically show up and then disappear.

jyun261 commented 2 years ago

Ok Neil, I just fixed the issue where the prevButton shows for a second on load.

Shouldn't we also do the same thing for the nextPg button? Because if there is only 1 quiz in the queue, the next pg icon should not automatically show up and then disappear.

Riiiiiiight did not consider that let me fix that.