VocaDB / vocadb

VocaDB is a Vocaloid Database with translated artists, albums, music videos and more.
https://vocadb.net
Other
334 stars 40 forks source link

Event series having both katakana/hiragana name variants disallows creating events #1804

Open saturclay opened 1 month ago

saturclay commented 1 month ago

Website (required)

[VocaDB / UtaiteDB / TouhouDB]

Describe the bug (required)

When you try to create an event for an event series where the series' name has both a katakana and hiragana variant (that are otherwise identical), then you'll get a "bad request" notification and be told the event name is already in use (even though it isn't) by event ID X (with X being the next unused event value).

Steps to reproduce the behavior:

  1. Go to this example on the beta site.
  2. Attempt to create an event in the series.
  3. See the "bad request" text and error message (this was from the event series on TouhouDB, which I've now fixed): Screenshot 2024-08-20 at 1 29 10 PM

Each time you hit save, the event ID increases by 1. This doesn't actually create an event though, and the audit log won't show any activity, nor will the ID appear in the data dump.

If you just remove the hiragana name, then it becomes possible to create events. Of course, the expected behavior would be to be able to create the event either way. However, this is a pretty odd circumstance and it seems pretty low priority now that I know what the problem was, so for the time being, I just want it to be known that this issue exists, in case such a circumstance happens again.

Checklist (required)

Fill out the checklist. Use strikethroughs or leave fields empty if you don't know or are unable to check/test.

saturclay commented 1 month ago

Also, I just checked whether it happens across the board with characters that are interpreted as being the same for search purposes, but it looks like this doesn't happen for, say, "event w" with the alias "event v", only for event series with the same hiragana/katakana name.

Susko3 commented 1 month ago

Katakana and hiragana don't really matter. You could have an event series with all three names set to the same thing and it still fails.

image

image

Susko3 commented 1 month ago

The problem also isn't with the event series, as the same issue can be reproduced when adding a standalone event. If any of the three names or aliases match (normalise to the same string) then the event can't be created.

image

Susko3 commented 1 month ago

This is currently working as intended:

https://github.com/VocaDB/vocadb/blob/17d2d0c96dc9e63795edeeec111c96b19c626af7/VocaDbModel/Database/Queries/Partial/UpdateEventNamesQuery.cs#L34

The odd things are:

  1. Duplicate names are allowed on other entry types (I checked artists, and importantly, event series)
  2. When creating an event and a duplicate name is given, a new ID is allocated, but it leads to a 404
FinnRG commented 1 month ago

@Susko3

  1. Tags would be an example of another entry type where every name needs to be unique
  2. The ID allocation is just the way SQL DBs handle serial integers. The event is inserted as a transaction, this advances the series, then the transaction gets aborted and the insertion gets rolled back, but not the integer series. This is completely as intended. (So no event is actually ever created with the new ids)

So the core question here is if we should remove the unique name requirements for events and their event series. For that it might be good to know why this rule exists in the first place. @Shiroizu or @andreoda might know more about this.