Travel-Mate
Travel-Mate copied to clipboard
Checklist appears same in different accounts accessed from same device.
Changes made to checklist in one account appears in a different one if they are accessed from same device.
Steps to reproduce
1.Login 2.Make changes to checklist. 3.Login from a different account. 4.Move to Checklist Option You'll find the same checklist as was in previous account.
Expected behaviour
Checklist should appear according to the changes made in a particular account.
Would you like to work on the issue?
Yes!
How would you like to go on this one? We don't have anything saved on the server related to checklist right now. It's just a local database.
Yeah it is being saved locally rather than in server. You are currently working in issue #94. Once that is done then you can go ahead with this issue
@aayushinigam If you think we would require an API to save the checklist items on the cloud & sync it whenever user logs in, you can open an issue here https://github.com/project-travel-mate/server/issues By the time you are done with your previous issue, this API might also be ready 👍
Actually I encountered this issue while working on issue #94. I was checking functionality and encountered this one. So I opened this issue.
An issue has been created for the same on the server side to fetch & sync the checklist items. ( https://github.com/project-travel-mate/server/issues/46 )
- When the user logs in for the first time, just fetch the checklist items
- Add a sync button on the Action bar
- whenever the user clicks on sync button, send the new checklist items to the server.
any progress here?
Other option is to link gmail account, The way google keep app saves checklist notes
We would be linking it to travel-mate account only. A server-side issue is already created for this.
@Swati4star @santoshhiremani @aayushinigam One possible solution could be storing the checklist along with the user ID and fetching only the items with current user's user ID.
Can I work on this issue?
Sure @Balram02
We can different databases for checklist as per user id. Let me know if you get stuck somewhere.
@Balram02 any updates?
@prabhakar267 will send PR within 3-4 days.
Can i work on this issue? Would you like to mount a different DB depending on which user is logged in, or would to use the single database and extended the tables to contain the user id?
I'll prefer different DBs
@Swati4star great, i will work on this one tomorrow.
@Swati4star With this fix, when it rolls out to production and the user updates, are you happy for the existing (Singular) database to become owned by the current user, then going forward a new database will be created for each logged in user?
[Additional fix] The above will cause cached application data to be duplicated across each user database, would you like me to split these out:
- DB for cached app data shared by all users
- DB for user specific data
I assume there is a plan to move the users data to the server? If so it may pay to leave the "Additional fix" for now to avoid modifying and reverting code changes?
With this fix, when it rolls out to production and the user updates, are you happy for the existing (Singular) database to become owned by the current user, then going forward a new database will be created for each logged in user?
Yes, sounds good.
Leave the additional fix for now.
This one is going to take me some time, if anyone else wants to have a go that's cool, otherwise ill submit a pull as soon as i can.
@Swati4star i'm pretty stuck on this one, can i extend the tables with user-id?
@lewisgarton Do you mind if I take this up? @Swati4star
@ritesh-pandey Go ahead.
I have created a draft PR with changes in only database file. Please let me know if it the desired way to solve this issue.
There are two classes - DbChecklist
and AppDataBase
which extend RoomDatabase
. Both of have entity ChecklistItem
.
- Why do we have two databases with same entity?
- Which one is used in
ChecklistFragment
? ItsModelView
is bound toDbChecklist
. But items are inserted viaWidgetCheckListDao
inAppDataBase
. - Do we have to make schema changes in both tables?
Can someone please guide me through this?
PS: I am new to Android development. Please let me know if I am wrong in understanding this.
@ritesh-pandey Instead of adding a new column (user-id) in the existing database, I'll prefer if we can have different database table for different user (maybe append userid to tablename). In the CheckListFragment, you can check which user id logged in, and load the corresponding table.
Instead of adding a new column (user-id) in the existing database, I'll prefer if we can have different database table for different user (maybe append userid to tablename).
If I understand correctly, you want a different table for different users in the same database. Table name can be governed by some configuration e.g. append table name with user id like events_new_12345
I am unable to find a relevant API/way to achieve this.
Closest implementation I could find was this link.