Travel-Mate icon indicating copy to clipboard operation
Travel-Mate copied to clipboard

Checklist appears same in different accounts accessed from same device.

Open aayushinigam opened this issue 6 years ago • 26 comments

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!

aayushinigam avatar Jun 28 '18 15:06 aayushinigam

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.

Swati4star avatar Jun 28 '18 15:06 Swati4star

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

knightcube avatar Jun 28 '18 15:06 knightcube

@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 👍

Swati4star avatar Jun 28 '18 15:06 Swati4star

Actually I encountered this issue while working on issue #94. I was checking functionality and encountered this one. So I opened this issue.

aayushinigam avatar Jun 28 '18 16:06 aayushinigam

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.

Swati4star avatar Jun 29 '18 15:06 Swati4star

any progress here?

prakhar1001 avatar Oct 03 '18 11:10 prakhar1001

Other option is to link gmail account, The way google keep app saves checklist notes

santoshhiremani avatar Oct 16 '18 14:10 santoshhiremani

We would be linking it to travel-mate account only. A server-side issue is already created for this.

Swati4star avatar Oct 17 '18 05:10 Swati4star

@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.

prabhakar267 avatar Oct 03 '19 12:10 prabhakar267

Can I work on this issue?

Balram02 avatar Oct 12 '19 11:10 Balram02

Sure @Balram02

We can different databases for checklist as per user id. Let me know if you get stuck somewhere.

Swati4star avatar Oct 12 '19 12:10 Swati4star

@Balram02 any updates?

prabhakar267 avatar Oct 21 '19 19:10 prabhakar267

@prabhakar267 will send PR within 3-4 days.

Balram02 avatar Oct 23 '19 09:10 Balram02

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?

lewisgarton avatar Jan 16 '20 06:01 lewisgarton

I'll prefer different DBs

Swati4star avatar Jan 16 '20 07:01 Swati4star

@Swati4star great, i will work on this one tomorrow.

lewisgarton avatar Jan 16 '20 09:01 lewisgarton

@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:

  1. DB for cached app data shared by all users
  2. 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?

lewisgarton avatar Jan 19 '20 01:01 lewisgarton

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.

Swati4star avatar Jan 19 '20 05:01 Swati4star

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.

lewisgarton avatar Jan 22 '20 08:01 lewisgarton

@Swati4star i'm pretty stuck on this one, can i extend the tables with user-id?

lewisgarton avatar Feb 01 '20 23:02 lewisgarton

@lewisgarton Do you mind if I take this up? @Swati4star

ritesh-pandey avatar Jun 20 '20 14:06 ritesh-pandey

@ritesh-pandey Go ahead.

prabhakar267 avatar Jun 20 '20 16:06 prabhakar267

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.

ritesh-pandey avatar Jun 20 '20 18:06 ritesh-pandey

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? Its ModelView is bound to DbChecklist. But items are inserted via WidgetCheckListDao in AppDataBase.
  • 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 avatar Jun 21 '20 06:06 ritesh-pandey

@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.

Swati4star avatar Jun 21 '20 11:06 Swati4star

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.

ritesh-pandey avatar Jun 21 '20 17:06 ritesh-pandey