Data salad after change weight with new Taxonomy

Created on 25 April 2024, 8 months ago
Updated 16 May 2024, 7 months ago

Problem/Motivation
- System create wrong Taxonomy
- System replaces selected taxonomy (destroys existing data sets)

Steps to reproduce
Need content type with data field, data field needs referenced taxonomy field
Need Taxonomy with existing Taxonomy
Create new content or edit a content
Chose a existing Taxonomy, write a new Taxonomy (Taxonomy not exist), change position from new Taxonomy on first place.
now save
Edit again, now new Taxonmy has name from Chose Taxonomy inclusive id.

Example:
Exist Taxonomy is: "Test 1 (123)"
News Taxonomy is: "Test 2" <- Place over Test 1
After save
"Test 1 (123) (456)"
"Test 1 (123)"
You can't select "Test 1 (123)" now it's save correct, after re edit shows:
"Test 1 (123) (456)"
"Test 1 (123) (456)"

my thesis:

The system orientates itself on the last entry and checks whether it is new. But since the new entry was moved, the last entry is the existing entry and adds it, including the id in brackets. The actually new entry now gets the new ID with the other term with ID in brackets.

Furthermore, when you open it in edit mode, the system apparently checks the taxonomy terms and assigns the IDs based on the terms. This means that the incorrect term created overwrites the new term. After saving, the previously correct term is now overwritten with the new incorrect term.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany heavystonehead

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @heavystonehead
  • πŸ‡©πŸ‡ͺGermany heavystonehead

    small note, I only recently noticed the problem (I've been looking for the cause for a week now) but it seems to have existed since version 1.x to 2.x and dev. I have had anomalies in the DB since December

  • πŸ‡«πŸ‡·France lazzyvn paris

    It was fixed because of the original delta. check dev version. I never thought about this situation. No one swaps line and changes the entity's name to autocreates a new one

  • πŸ‡©πŸ‡ͺGermany heavystonehead

    The reordering issue appears to be resolved. Now only the 2nd anomaly remains.

    If there is a taxonomy β€œTest 1” with ID 5 and a taxonomy β€œTest 1 (2)” with ID x, test 1 is selected and saved normally.
    If there is a taxonomy "Test 1" with ID 5 and a taxonomy "Test 1 (5)" with ID x, then Test 1 will be saved as "Test 1 (5)" with ID x.

    Thesis:
    The terms are compared here and the ID is added as soon as terms exist. The existing IDs are not used here. This probably even happens afterwards, because correctly saved content is replaced with the wrong term after saving.

  • πŸ‡«πŸ‡·France lazzyvn paris

    It's normal because it get id from title (id)

    $result = preg_match('/\((\d+)\)$/', $value, $matches);
    if ($result > 0) {
            $value = $matches[$result];
    }
    

    so it takes the last one. I don't know how to do better

  • Status changed to Fixed 8 months ago
  • πŸ‡«πŸ‡·France lazzyvn paris
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024