Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Fix integrity sorting in page with nested containers #512

Merged

Conversation

extcode
Copy link
Contributor

@extcode extcode commented Jun 25, 2024

Relates: #458

@extcode extcode force-pushed the fix_sorting_in_page_for_nested_containers branch from a2bff7f to f7e78be Compare June 25, 2024 13:52
$container->getChildRecords() only used for the condition. We can remove
this, because the new getAfterContainerRecord() returns the container
itself if ce has no children. We than can check if the uids are equal.
This improvement allows to extract the $sorting from the condition so we
only have the else block.
@achimfritz
Copy link
Contributor

i do not understand this example, because integrity is broken, and this looks not like a sorting problem?
if i import you dataset i have
uid 2 and uid 5 as unused elements
after running sorting-in-page i have uid 5 unused (and uid 2 is used, this should not be changed by sorting)
can you please construct a non-broken dataset?

@extcode
Copy link
Contributor Author

extcode commented Jun 26, 2024

I will take another look at the test setup. This is a customized example from a current project. From our point of view, the data in this project is not repaired correctly, so that moving content elements is not possible in certain situations.

@extcode extcode closed this Jun 26, 2024
@extcode extcode reopened this Jun 26, 2024
@extcode
Copy link
Contributor Author

extcode commented Jun 27, 2024

This is the scenario in our project. I hope that I now have correctly reduced the IDs and sorting to small numbers. The uids of the containers and content elements are 6 digits in the project. The numbers for the sorting are mostly 4 digits, because there is a lot of content on the pages.

We cannot move the container with id:6 over the one with id:4, because for the calculation of the last child the sorting is not returned from the element id:3 but from id:2.

TYPO3 should therefore move id:6 to id:2. From TYPO3's point of view, however, nothing needs to be done here because sorting:3 of id:2 is greater than sorting:2 of id:6.

+---------------------------------------------------+
| id:1                                              |
| sorting:1                                         |
| colPos:0                                          |
|-------------------------+-------------------------+
|                         | id:2                    |
|                         | sorting:2               |
|                         | colPos:202              |
|                         +------------+------------+
|                         |            | id:3       |
|                         |            | sorting:5  |
|                         |            | colPos:202 |
+-------------------------+------------+------------+

+---------------------------------------------------+
| id:4                                              |
| sorting:3                                         |
| colPos:0                                          |
|-------------------------+-------------------------+
|                         | id:5                    |
|                         | sorting:4               |
|                         | colPos:202              |
+-------------------------+-------------------------+

+---------------------------------------------------+
| id:6                                              |
| sorting:6                                         |
| colPos:0                                          |
|-------------------------+-------------------------+
|                         | id:7                    |
|                         | sorting:7               |
|                         | colPos:202              |
+-------------------------+-------------------------+

As far as I can see, the command container:sorting checks the integrity of the containers id:1, id:4 and id:6.

The command container:sorting-in-page checks the containers one below the other and should correct the sorting for id:4 and following, because id:3 has set a higher value for sorting.
As I said, this does not happen because the last child of id:1 is not actually fetched.

With commit d1381f4 the test setup should be fixed. I debugged the $rows before and after running the command and get following changes for sorting (->). The colPos doesn't change anymore:

+---------------------------------------------------+
| id:1                                              |
| sorting:1                                         |
| colPos:0                                          |
|-------------------------+-------------------------+
|                         | id:2                    |
|                         | sorting:2               |
|                         | colPos:202              |
|                         +------------+------------+
|                         |            | id:3       |
|                         |            | sorting:5  |
|                         |            | colPos:202 |
+-------------------------+------------+------------+

+---------------------------------------------------+
| id:4                                              |
| sorting:3 -> 261                                  |
| colPos:0                                          |
|-------------------------+-------------------------+
|                         | id:5                    |
|                         | sorting:4 -> 517        |
|                         | colPos:202              |
+-------------------------+-------------------------+

Copy link
Contributor

@achimfritz achimfritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@achimfritz achimfritz merged commit ef6cc8d into b13:master Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants