fix: hide variants term for multi-EL professions without variants

This commit is contained in:
Lukas Obermann
2026-06-01 22:54:37 +02:00
parent 0be5077332
commit 25331f9e92
2 changed files with 18 additions and 1 deletions
+8
View File
@@ -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 parents 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 locales rules for the given type.
*/
+10 -1
View File
@@ -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 =>