fix: hide variants term for multi-EL professions without variants
This commit is contained in:
@@ -318,6 +318,14 @@ export const getChildInstancesForInstanceIdR = <CE extends keyof ChildEntityMap>
|
||||
{ id: string; content: ChildEntityMap[CE][0] }[]
|
||||
> => Reader.asks(env => env.getChildInstancesForInstanceId(entityName, parentId))
|
||||
|
||||
/**
|
||||
* Gets a function to retrieve all child instances of an entity from the database by their child entity name and their parent’s identifier.
|
||||
*/
|
||||
export const getChildInstancesForInstanceIdFnR = <CE extends keyof ChildEntityMap>(): Reader<
|
||||
{ getChildInstancesForInstanceId: GetAllChildInstancesForParent<CE> },
|
||||
GetAllChildInstancesForParent<CE>
|
||||
> => Reader.asks(env => env.getChildInstancesForInstanceId)
|
||||
|
||||
/**
|
||||
* Joins a list of strings according to the locale’s rules for the given type.
|
||||
*/
|
||||
|
||||
@@ -93,6 +93,7 @@ import {
|
||||
attributedNameR,
|
||||
customNameR,
|
||||
formatR,
|
||||
getChildInstancesForInstanceIdFnR,
|
||||
getChildInstancesForInstanceIdR,
|
||||
getInstanceByIdR,
|
||||
localeCompareR,
|
||||
@@ -1404,7 +1405,15 @@ const groupProfessionVariantsThatContainTheSameChanges = (
|
||||
|
||||
const renderProfessionVariants = (professionPackages: NonEmptyArray<PreparedProfessionPackage>) =>
|
||||
professionPackages.length > 1
|
||||
? Reader.of(UNHANDLED_VALUE)
|
||||
? getChildInstancesForInstanceIdFnR<"ProfessionVariant">().map(
|
||||
getChildInstancesForInstanceId =>
|
||||
professionPackages.some(
|
||||
professionPackage =>
|
||||
getChildInstancesForInstanceId("ProfessionVariant", professionPackage.id).length > 0,
|
||||
)
|
||||
? UNHANDLED_VALUE
|
||||
: undefined,
|
||||
)
|
||||
: getChildInstancesForInstanceIdR("ProfessionVariant", professionPackages[0].id).thenW(
|
||||
variants =>
|
||||
groupProfessionVariantsThatContainTheSameChanges(variants).thenW(groupedVariants =>
|
||||
|
||||
Reference in New Issue
Block a user