BrainPhaser icon indicating copy to clipboard operation
BrainPhaser copied to clipboard

Adding new Questions

Open AbanoubG opened this issue 8 years ago • 14 comments
trafficstars

When adding new questions to the challenges.bpc and submitting an update to the play store, it does not show the new questions for the user. I had to go into my app settings and clear the data. Only then did it show the new questions. Is there someway to show the new questions without having to do this? Also for some reason Import doesn't show in the production version of the app in the play store but when I run it in the emulator it does

AbanoubG avatar Feb 23 '17 07:02 AbanoubG

The challenges.bpc is loaded to the database only once when the app is loaded. What you could do is store the challenges version somewhere in the App and then import only the new ones in app start.

You could then use the FileImport class in de.fhdw.ergoholics.brainphaser.logic.fileimport to load your incremental changes. You'd also need to patch ProxyActivity to do this.

What you can also do is allow your users to download the new challenges as bpc file. (For example on your website). bpc files are automatically associated with the app so users could import new challenges by downloading and opening the file.

A PR to allow for updating automatically would be very welcome! This was something we didn't consider when coding the app.

ValentinFunk avatar Feb 23 '17 13:02 ValentinFunk

I am a new developer and my abilities are limited in terms of doing a PR. In any case, when allowing users to download a new challenges as a bpc file, I get duplicates of each category. I'm trying to look for the simplest way in which I could add new questions via an update. Any ideas on how I could achieve this based upon my limited skill set? Perhaps their is a way to clear the loaded database upon new version launch

AbanoubG avatar Feb 23 '17 18:02 AbanoubG

You'd have to give them only the added questions in the bpc. I agree it's not a very good solution.

I believe what I posted above would be the most simple way (but it does require a bit of implementation). You could clear the database but that would also mean clearing all of their progress on updates.

If you want to give it a shot and get stuck anywhere i'm always here to help as well :smile:

ValentinFunk avatar Feb 24 '17 10:02 ValentinFunk

Thanks Kamshak for the help. If you would like to see the project that I made by forking your application, it's on my GitHub profile. I wouldn't have been able to do anything without your help. In terms of implementing this, I will try and do more research regarding this matter.( Perhaps on Stack Overflow.) In the mean time, I tell the users to clear the app data via a push notification until I can figure out how to implement what was stated above lol

Thank you for your constant help and advice

AbanoubG avatar Feb 24 '17 22:02 AbanoubG

Would this work? (Referring to the accepted answer) I am assuming that I would put it in the DataBaseModule.Java. Any ideas?

http://stackoverflow.com/questions/23881317/delete-sqlite-database-when-updating-new-version-of-application

AbanoubG avatar Feb 28 '17 02:02 AbanoubG

You could do this but it will remove all user progress. For that you'd just need to change the number in https://github.com/Kamshak/BrainPhaser/blob/master/brainphaserdaogenerator/src/main/java/de/fhdw/ergoholics/brainphasergenerator/BrainphaserDaoGenerator.java#L14

ValentinFunk avatar Mar 01 '17 15:03 ValentinFunk

In other words, if I were to pursue this route, I would periodically change this number with each subsequent addition of questions and app version? It will remove all user progress however it would show all questions. Correct?

AbanoubG avatar Mar 02 '17 04:03 AbanoubG

Yep that's correct.

Just thought of another way: You could use the DB migration to run your question migrations as well and change the DB version whenever you add questions. There is some information here: http://stackoverflow.com/questions/13373170/greendao-schema-update-and-data-migration basically you'd need to subclass DaoMaster.OpenHelper and provide a custom onUpgrade method. In that method you could use FileImport to import the new questions via BPC. (You'd have a BPC for app install, and then each time you add questions a new BPC with only the added questions)

ValentinFunk avatar Mar 02 '17 12:03 ValentinFunk

hi, i am new in Android.

I would like to know where I can modify the path where the database is stored on my device. I have read that by default it is saved in / data/data/... but it can only be seen as root.

tonyesna avatar Mar 29 '17 16:03 tonyesna

@tonyesna: Please open a new issue next time :)

What you need to do is change the database name here, change prodDb to /mnt/sdcard/database_name.db

ValentinFunk avatar Mar 31 '17 06:03 ValentinFunk

@Kamshak How to disable the no challenges due after users has completed all the quiz? I would like to let users to repeat doing the quiz.

zfc0812 avatar Oct 01 '17 11:10 zfc0812

@zfc0812 the way it works at the moment is by spaced repetition, they'll get asked the questions again after a specified period of time (you can set it in the app settings)

ValentinFunk avatar Oct 09 '17 08:10 ValentinFunk

How can I use images in the multiple choice question rather than text. display images in the options.

farhannaseer88 avatar Oct 10 '17 04:10 farhannaseer88

@farhannaseer88 please see #56

ValentinFunk avatar Oct 10 '17 11:10 ValentinFunk