Skip to content

Commit

Permalink
address some more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Oct 25, 2023
1 parent 66aaf27 commit e0af838
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
Btn,
JUSTIFY_END,
} from '@opentrons/components'
import { getPipetteNameSpecs, LEFT } from '@opentrons/shared-data'
import { getPipetteNameSpecs } from '@opentrons/shared-data'
import { i18n } from '../../../localization'
import { getLabwareDefsByURI } from '../../../labware-defs/selectors'
import { createCustomTiprackDef } from '../../../labware-defs/actions'
Expand Down
16 changes: 8 additions & 8 deletions protocol-designer/src/labware-defs/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
OPENTRONS_LABWARE_NAMESPACE,
LabwareDefinition2,
} from '@opentrons/shared-data'
import { getPipetteEntities } from '../step-forms/selectors'
import { getAllWellSetsForLabware } from '../utils'
import * as labwareDefSelectors from './selectors'
import { getAllWellSetsForLabware, getHas96Channel } from '../utils'
import type { ThunkAction } from '../types'
import type { LabwareUploadMessage } from './types'
import { getPipetteEntities } from '../step-forms/selectors'
export interface LabwareUploadMessageAction {
type: 'LABWARE_UPLOAD_MESSAGE'
payload: LabwareUploadMessage
Expand Down Expand Up @@ -94,14 +94,14 @@ const _createCustomLabwareDef: (
) => (
event: React.SyntheticEvent<HTMLInputElement>
) => ThunkAction<any> = onlyTiprack => event => (dispatch, getState) => {
const allLabwareDefs: LabwareDefinition2[] = values(
labwareDefSelectors.getLabwareDefsByURI(getState())
)
const pipetteEntities = getPipetteEntities(getState())
const has96Channel = getHas96Channel(pipetteEntities)
const customLabwareDefs: LabwareDefinition2[] = values(
const customLabwareDefs = values(
labwareDefSelectors.getCustomLabwareDefsByURI(getState())
)
const allLabwareDefs = values(
labwareDefSelectors.getLabwareDefsByURI(getState())
)
const pipetteEntities = values(getPipetteEntities(getState()))
const has96Channel = pipetteEntities.some(pip => pip.spec.channels === 96)
// @ts-expect-error(sa, 2021-6-20): null check
const file = event.currentTarget.files[0]
const reader = new FileReader()
Expand Down
15 changes: 5 additions & 10 deletions shared-data/js/helpers/wellSets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ type WellSetByPrimaryWell = string[][]

// Compute all well sets for a labware def (non-memoized)
function _getAllWellSetsForLabware(
labwareDef: LabwareDefinition2,
channels: 8 | 96
labwareDef: LabwareDefinition2
): WellSetByPrimaryWell {
const allWells: string[] = Object.keys(labwareDef.wells)

Expand Down Expand Up @@ -67,8 +66,7 @@ export const makeWellSetHelpers = (): WellSetHelpers => {
}> = {}

const getAllWellSetsForLabware = (
labwareDef: LabwareDefinition2,
channels: 8 | 96
labwareDef: LabwareDefinition2
): WellSetByPrimaryWell => {
const labwareDefURI = getLabwareDefURI(labwareDef)
const c = cache[labwareDefURI]
Expand All @@ -79,7 +77,7 @@ export const makeWellSetHelpers = (): WellSetHelpers => {
return c.wellSetByPrimaryWell
}

const wellSetByPrimaryWell = _getAllWellSetsForLabware(labwareDef, channels)
const wellSetByPrimaryWell = _getAllWellSetsForLabware(labwareDef)

cache[labwareDefURI] = {
labwareDef,
Expand All @@ -98,10 +96,7 @@ export const makeWellSetHelpers = (): WellSetHelpers => {
* Ie: C2 for 96-flat => ['A2', 'B2', 'C2', ... 'H2']
* Or A1 for trough => ['A1', 'A1', 'A1', ...]
**/
const allWellSetsFor8Channel = getAllWellSetsForLabware(
labwareDef,
channels
)
const allWellSetsFor8Channel = getAllWellSetsForLabware(labwareDef)
/** getting all wells from the plate and turning into 1D array for 96-channel
*/
const orderedWellsFor96Channel = orderWells(
Expand Down Expand Up @@ -136,7 +131,7 @@ export const makeWellSetHelpers = (): WellSetHelpers => {
return true
}

const allWellSets = getAllWellSetsForLabware(labwareDef, 8)
const allWellSets = getAllWellSetsForLabware(labwareDef)
return allWellSets.some(wellSet => {
const uniqueWells = uniq(wellSet)
// if all wells are non-null, and there are either 1 (reservoir-like)
Expand Down

0 comments on commit e0af838

Please sign in to comment.