nextcloud / bookmarks

🔖 Bookmark app for Nextcloud
https://apps.nextcloud.com/apps/bookmarks
GNU Affero General Public License v3.0
1k stars 173 forks source link

Tags duplicate on bookmarks #1241

Closed lyallp closed 3 years ago

lyallp commented 3 years ago

Describe the bug When filtering bookmarks by tags, some bookmarks show their one and only tag multiple times. Attempts to delete the excess tags only makes it worse

To Reproduce Steps to reproduce the behavior: Unsure as to what causes this behavior but after looking at SQL Tables suspect there is a join issue between oc_bookmarks and oc_bookmarks_tags

Expected behavior Expect there to only one instance of a given tag per bookmark

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

Server (please complete the following information):

Additional context Add any other context about the problem here.

Web server error log

Nextcloud log (nextcloud/data/nextcloud.log)

endless entries of notifications and sqlite3 already being loaded

Browser log

marcelklehr commented 3 years ago

Since you looked at the SQL tables, did you see the same bookmark_id - tag combination multiple times in oc_bookmarks_tags?

lyallp commented 3 years ago

There are only 4 'My Hosted' rows in oc_bookmarks_tags SELECT * FROMoc_bookmarks_tagswhere tag = 'My Hosted' ORDER BYbookmark_idASC yet, screenshot shows 6 Nextcloud bookmark in oc_bookmarks is id 5 There is only one oc_bookmarks_tags row with bookmark_id = 5 I must admit, the association of tags to bookmarks seems a little weird to me, I expected a structure something like bookmark.id <-> bookmark_tags <-> tag.id where each bookmark row may have zero or more bookmark_tags and the tag only exists once in tags. Still, I am not the author, and really am not in a position to criticize when I have not created something. I am happy to look at the sql in question, my problem is not knowing where to look!

I don't have many bookmarks, happy to export tables for examination.

marcelklehr commented 3 years ago

Thanks that's very helpful. The problem is a select query, then.

I must admit, the association of tags to bookmarks seems a little weird to me

Yes, there's a bit of tech debt in there.

lyallp commented 3 years ago

Fixed and seems faster to boot!