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

Clone region copies page tree id instead of assigning a new one #1259

Closed
svenseeberg opened this issue Mar 3, 2022 · 3 comments · Fixed by #1263
Closed

Clone region copies page tree id instead of assigning a new one #1259

svenseeberg opened this issue Mar 3, 2022 · 3 comments · Fixed by #1263
Assignees
Labels
‼️ prio: high Needs to be resolved ASAP. 🐛 bug Something isn't working
Milestone

Comments

@svenseeberg
Copy link
Member

svenseeberg commented Mar 3, 2022

Describe the Bug

After duplicating a region, the page tree is copied but the tree_id for the new region is keeping the same value as the original tree.

integreat=# SELECT * FROM cms_page WHERE tree_id=221;
  id  |         created_date          | explicitly_archived | lft | rgt | tree_id | depth | mirrored_page_first | icon_id | mirrored_page_id | organization_id | parent_id | region_id 
------+-------------------------------+---------------------+-----+-----+---------+-------+---------------------+---------+------------------+-----------------+-----------+-----------
 2681 | 2022-02-21 19:52:46+00        | f                   |   2 |   7 |     221 |     2 | t                   |    5041 |                  |                 |      2680 |       160
 2682 | 2022-02-21 19:52:46+00        | f                   |   3 |   4 |     221 |     3 | t                   |         |                  |                 |      2681 |       160
 2683 | 2022-02-21 19:52:46+00        | f                   |   5 |   6 |     221 |     3 | t                   |         |                  |                 |      2681 |       160
 2757 | 2022-03-03 15:14:11.79442+00  | f                   |  12 |  17 |     221 |     2 | t                   |   18036 |                  |                 |      2680 |       136
 2680 | 2022-02-21 19:52:46+00        | f                   |   1 |  18 |     221 |     1 | t                   |    5251 |                  |                 |           |       160
 2758 | 2022-03-03 15:16:46.809255+00 | f                   |  15 |  16 |     221 |     3 | t                   |         |                  |                 |      2757 |       136
 2756 | 2022-03-03 14:57:47.883672+00 | f                   |  13 |  14 |     221 |     3 | t                   |         |                  |                 |      2757 |       136
 2684 | 2022-02-21 19:52:46+00        | f                   |   8 |   9 |     221 |     2 | t                   |    5054 |                  |                 |      2680 |       160
 2685 | 2022-02-21 19:52:46+00        | f                   |  10 |  11 |     221 |     2 | t                   |    5345 |                  |                 |      2680 |       160
  994 | 2022-02-21 19:52:46+00        | f                   |   5 |   6 |     221 |     3 | t                   |         |                  |                 |       990 |       136
  993 | 2022-02-21 19:52:46+00        | f                   |   3 |   4 |     221 |     3 | t                   |         |                  |                 |       990 |       136
  992 | 2022-02-21 19:52:46+00        | f                   |  10 |  11 |     221 |     2 | t                   |    5345 |                  |                 |       989 |       136
  991 | 2022-02-21 19:52:46+00        | f                   |   8 |   9 |     221 |     2 | t                   |    5054 |                  |                 |       989 |       136
  989 | 2022-02-21 19:52:46+00        | f                   |   1 |  18 |     221 |     1 | t                   |    5251 |                  |                 |           |       136
  990 | 2022-02-21 19:52:46+00        | f                   |   2 |   7 |     221 |     2 | t                   |    5041 |                  |                 |       989 |       136

Other tree IDs with 2 root pages: 236, 230, 238, 234

Expected Behavior

Only one root page per tree.

Additional Information

This is a remant of the migration.

@svenseeberg svenseeberg added the 🐛 bug Something isn't working label Mar 3, 2022
@svenseeberg svenseeberg added this to the Version 1.1 milestone Mar 3, 2022
@svenseeberg svenseeberg added the ‼️ prio: high Needs to be resolved ASAP. label Mar 3, 2022
@svenseeberg
Copy link
Member Author

svenseeberg commented Mar 3, 2022

It seems that all translations are fully redundant for the duplicate pages. That means we can probably just delete one page and all of its translations.

The same is happening in the test CMS with the following tree IDs: 160, 357, 358, 165, 168, 163, 158, 165

@svenseeberg svenseeberg changed the title Two page treee root nodes Doubled page tree root nodes Mar 3, 2022
@svenseeberg
Copy link
Member Author

@timobrembeck
Copy link
Member

I could reproduce this locally on develop. Duplicating a region causes duplicate tree ids for different trees of different regions, because the pages are just copied without the value of the tree_id field changed.

@timobrembeck timobrembeck reopened this Mar 3, 2022
@svenseeberg svenseeberg changed the title Doubled page tree root nodes Clone region copies page tree id instead of assigning a new one Mar 3, 2022
@timobrembeck timobrembeck self-assigned this Mar 3, 2022
timobrembeck added a commit that referenced this issue Mar 4, 2022
Add test case which fails in the current state to reproduce #1259
timobrembeck added a commit that referenced this issue Mar 4, 2022
- Add test case which fails in the current state to reproduce #1259
- Order translation models by language to keep deterministic order to compare querysets
timobrembeck added a commit that referenced this issue Mar 5, 2022
- Add test case which fails in the current state to reproduce #1259
- Order translation models by language to keep deterministic order to compare querysets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
‼️ prio: high Needs to be resolved ASAP. 🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants