-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
1 - BugIncorrect behavior of the productIncorrect behavior of the product2 - TreesIssues that are related to the tree system and related functionalities.Issues that are related to the tree system and related functionalities.
Milestone
Description
Say you have a database where the found {not_nested_count} nodenumbers not nested by parent error is taking place– the 'Repair Tree' button will be unable to solve this. It does not renumber the tree despite claiming to...
specify7/specifyweb/specify/tree_extras.py
Lines 597 to 625 in 2148663
| def validate_tree_numbering(table): | |
| logger.info('validating tree') | |
| cursor = connection.cursor() | |
| cursor.execute( | |
| "select count(*), count(distinct nodenumber), count(highestchildnodenumber)\n" | |
| "from {table}".format(table=table) | |
| ) | |
| node_count, nn_count, hcnn_count = cursor.fetchone() | |
| assert node_count == nn_count == hcnn_count, \ | |
| "found {} nodes but {} nodenumbers and {} highestchildnodenumbers" \ | |
| .format(node_count, nn_count, hcnn_count) | |
| cursor.execute(( | |
| "select count(*) from {table} t join {table} p on t.parentid = p.{table}id\n" | |
| "where t.rankid <= p.rankid\n" | |
| "and t.acceptedid is null" | |
| ).format(table=table)) | |
| bad_ranks_count, = cursor.fetchone() | |
| assert bad_ranks_count == 0, \ | |
| "found {} cases where node rank is not greater than its parent." \ | |
| .format(bad_ranks_count) | |
| cursor.execute(( | |
| "select count(*) from {table} t join {table} p on t.parentid = p.{table}id\n" | |
| "where t.nodenumber not between p.nodenumber and p.highestchildnodenumber\n" | |
| ).format(table=table)) | |
| not_nested_count, = cursor.fetchone() | |
| assert not_nested_count == 0, \ | |
| f"found {not_nested_count} nodenumbers not nested by parent" |
Metadata
Metadata
Assignees
Labels
1 - BugIncorrect behavior of the productIncorrect behavior of the product2 - TreesIssues that are related to the tree system and related functionalities.Issues that are related to the tree system and related functionalities.
Type
Projects
Status
📋 Backlog
Status
To do