Skip to content

Commit

Permalink
clean up nested ternery
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Oct 25, 2023
1 parent c335e51 commit d4feaf8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions protocol-designer/src/top-selectors/labware-locations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,21 @@ export const getUnocuppiedLabwareLocationOptions: Selector<
const modSlot =
modIdWithAdapter != null ? modules[modIdWithAdapter].slot : null
const isAdapter = getIsAdapter(labwareId, labwareEntities)
const moduleUnderAdapter =
modIdWithAdapter != null
? getModuleDisplayName(moduleEntities[modIdWithAdapter].model)
: 'unknown module'
const moduleSlotInfo = modSlot ?? 'unknown slot'
const adapterSlotInfo = adapterSlot ?? 'unknown adapter'

return labwareOnAdapter == null && isAdapter
? [
...acc,
{
name:
modIdWithAdapter != null
? `${adapterDisplayName} on top of ${
modIdWithAdapter != null
? getModuleDisplayName(
moduleEntities[modIdWithAdapter].model
)
: 'unknown module'
} in slot ${modSlot ?? 'unknown slot'}`
: `${adapterDisplayName} on slot ${
adapterSlot ?? 'unknown'
}`,
? `${adapterDisplayName} on top of ${moduleUnderAdapter} in slot ${moduleSlotInfo}`
: `${adapterDisplayName} on slot ${adapterSlotInfo}`,
value: labwareId,
},
]
Expand Down

0 comments on commit d4feaf8

Please sign in to comment.