Skip to content

Commit

Permalink
feat(app): Show all labware of same type as confirmed (#2525)
Browse files Browse the repository at this point in the history
Closes #2523
  • Loading branch information
mcous authored Oct 23, 2018
1 parent dce806b commit ab8fdd9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/robot/selectors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
// robot selectors
import padStart from 'lodash/padStart'
import some from 'lodash/some'
import {createSelector} from 'reselect'

import {
Expand Down Expand Up @@ -306,7 +307,16 @@ export const getLabware = createSelector(
.filter(isSlot)
.map((slot) => {
const labware = lwBySlot[slot]
const confirmed = confirmedBySlot[slot] || false
const {type, isTiprack} = labware

// labware is confirmed if:
// - tiprack: labware in slot is confirmed
// - non-tiprack: labware in slot or any of same type is confirmed
const confirmed = some(confirmedBySlot, (value, key) => (
value === true &&
(key === slot || (!isTiprack && type === lwBySlot[key].type))
))

let calibration: LabwareCalibrationStatus = 'unconfirmed'
let isMoving = false

Expand Down
11 changes: 11 additions & 0 deletions app/src/robot/test/selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ describe('robot selectors', () => {
calibratorMount: 'left',
},
5: {slot: '5', type: 'a', isTiprack: false},
7: {slot: '7', type: 'a', isTiprack: false},
9: {slot: '9', type: 'b', isTiprack: false},
},
pipettesByMount: {
Expand Down Expand Up @@ -591,6 +592,16 @@ describe('robot selectors', () => {
calibration: 'unconfirmed',
confirmed: true,
},
// then other labware by slot
{
slot: '7',
type: 'a',
isTiprack: false,
isMoving: false,
calibration: 'unconfirmed',
// note: labware a in slot 7 is confirmed because confirmed in slot 5
confirmed: true,
},
{
slot: '9',
type: 'b',
Expand Down

0 comments on commit ab8fdd9

Please sign in to comment.