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

Phylum and Division both display by default for botanical collections #3424

Open
grantfitzsimmons opened this issue Apr 27, 2023 · 6 comments
Labels
1 - Bug Incorrect behavior of the product 2 - Trees Issues that are related to the tree system and related functionalities. res:duplicate Duplicate of an existing issue

Comments

@grantfitzsimmons
Copy link
Member

grantfitzsimmons commented Apr 27, 2023

image

Specify 6 automatically hides the Division rank for Botanical collections and uses Phylum instead.
Specify 7 does not do this, so you have both ranks duplicated.

This is problematic in multiple ways, including in #3340.

RankID is the same for both, which is why you experience the problem.

@grantfitzsimmons grantfitzsimmons added 1 - Bug Incorrect behavior of the product pri:unknown labels Apr 27, 2023
@grantfitzsimmons grantfitzsimmons changed the title Phylum and Division both exist by default Phylum and Division both exist by default for botanical collections Apr 27, 2023
@maxpatiiuk
Copy link
Member

This is a Specify 6 Wizard bug
See specify/specify6#1200
I will close this as duplicate.
If you need it just for prioritization, than keep in mind that new github projects (the back-end priorities one) support including issues from several different repositories (even sp6 repo)

@maxpatiiuk maxpatiiuk closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2023
@maxpatiiuk
Copy link
Member

maxpatiiuk commented Apr 27, 2023

Doubt this will be fixed until #2932 is completed

@maxpatiiuk maxpatiiuk added the res:duplicate Duplicate of an existing issue label Apr 27, 2023
@grantfitzsimmons
Copy link
Member Author

grantfitzsimmons commented Jul 26, 2023

@maxpatiiuk Yes it is, but Specify 7 should not display both. Encountered again with Jerusalem.

@grantfitzsimmons grantfitzsimmons changed the title Phylum and Division both exist by default for botanical collections Phylum and Division both display by default for botanical collections Jul 26, 2023
@grantfitzsimmons
Copy link
Member Author

Ranks with the same RankID should not be shown twice

@grantfitzsimmons grantfitzsimmons added res:duplicate Duplicate of an existing issue 2 - Trees Issues that are related to the tree system and related functionalities. and removed res:duplicate Duplicate of an existing issue labels Jul 26, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Front-End Backlog Jul 26, 2023
@maxpatiiuk
Copy link
Member

Ah, now that you say that, it's a relatively simple solution to implement

this is the place where tree ranks are fetched

export const treeRanksPromise = Promise.all([
// Dynamic imports are used to prevent circular dependencies
import('../Permissions/helpers'),
import('../Permissions').then(async ({ fetchContext }) => fetchContext),
import('../DataModel/tables').then(async ({ fetchContext }) => fetchContext),
fetchDomain,
])
.then(async ([{ hasTreeAccess, hasTablePermission }]) =>
hasTablePermission('Discipline', 'read')
? getDomainResource('discipline')
?.fetch()
.then((discipline) => {
if (!f.has(paleoDiscs, discipline?.get('type')))
disciplineTrees = commonTrees;
})
.then(async () =>
Promise.all(
disciplineTrees
.filter((treeName) => hasTreeAccess(treeName, 'read'))
.map(async (treeName) =>
getDomainResource(getTreeScope(treeName) as 'discipline')
?.rgetPromise(
`${unCapitalize(treeName) as 'geography'}TreeDef`
)
.then(async (treeDefinition) => ({
definition: treeDefinition,
ranks: await fetchRelated(
serializeResource(treeDefinition),
'treeDefItems',
0
).then(({ records }) =>
Array.from(records).sort(
sortFunction(({ rankId }) => rankId)
)
),
}))
.then((ranks) => [treeName, ranks] as const)
)
)
)
: []
)
.then((ranks) => {
// @ts-expect-error
treeDefinitions = Object.fromEntries(ranks.filter(Boolean));
return treeDefinitions;
});

if I remember correctly, this is the only place where front-end fetches tree ranks, and all others use this place

just have to update this script to remove duplicate ranks.

quite simple to implment, assuming you are ok with us just picking the first matching rank, rather than doing smart choosing based on the current discipline

@emenslin
Copy link
Collaborator

Can recreate in edge (7.9.6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product 2 - Trees Issues that are related to the tree system and related functionalities. res:duplicate Duplicate of an existing issue
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants