Bug #89097
Updated by Riccardo De Contardi about 5 years ago
This issue is filled with my findings in investigating the issue #73644
When you add a category to some items
* if you edit the category and look at the tab "items" you will find all the items with that category
* if you look at the database, table sys_category > column "items" you would expect to see here the same number of items, but it does not always happen; this is why I tried to discover what happens with some tests.
h3. Preliminary stuff:
create new category ZZZZ
h3. Test 1
1) Create or open an existing page and assign category ZZZZ
1.1) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "0"
h3. Test 2
2) Create or open an existing content element and assign category ZZZZ
2.1) Create or open an existing content element and assign category ZZZZ
2.2) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "0"
h3. Test 3
3) Edit category ZZZZ > tab Items > remove the "page" item
3.1) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "2"
h3. Test 4
4) Open an existing file in file module and assign category ZZZZ
4.1) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "2"
h3. Test 5
5) Edit category ZZZZ > tab Items > remove the "CE" items
5.1) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "1"
h3. Test 6
6) Create or open an existing page and assign category ZZZZ
6.1) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "1"
From here, things are getting weird:
h3. Test 7
7) Edit category ZZZZ > tab Items > remove the "sys_file_metadata" item
7.1) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "1" (!) I would have expected "0" as the test 1.1!!
Adding another page, or adding a CE, it still reads "1"
h3. Test 8
8) Remove every item from the category
8.1) Create or open an existing content element and assign category ZZZZ
8.2) Create or open an existing content element and assign category ZZZZ
8.3) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "0" (!) I would have expected "2" as the test 3.1!!
h3. Test 9
9) Create or open an existing page and assign category ZZZZ
9.1) Edit category ZZZZ > tab Items > remove the "CE" items
9.2) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "1" (!)
h3. Test 10
10) Open an existing file in file module and assign category ZZZZ
10.1) Open an existing file in file module and assign category ZZZZ
10.2) Create or open an existing content element and assign category ZZZZ
10.3) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "0" (!)
h3. Test 11
11) Create or open an existing page and assign category ZZZZ
11.1) Edit category ZZZZ > tab Items > remove the "CE" item
11.2) Open the database > Table sys_category > look for the ZZZZ record > the items column reads "3" (!) (exact number of the items including page!)
h3. What I have learned so far
The behavior seems really weird and inconsistent, but from my tests it seems that
* when you enter one or more elements of the same type, the items column in the DB is not updated and reads "0"
* adding an element of a different type will not update it
* when you delete one element, it seems that the order of the elements is altered and this somehow triggers the update of the field
* this behavior seems confirmed if you manually order the items in the category ZZZZ > tab items
* as far as I can see (not entirely sure) this still does not fix #73644