Skip to content

Commit

Permalink
wip less bugs now
Browse files Browse the repository at this point in the history
  • Loading branch information
IanLondon committed Nov 23, 2020
1 parent 9bdc484 commit bfd837a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
1 change: 0 additions & 1 deletion protocol-designer/src/components/LiquidPlacementModal.js
Expand Up @@ -113,7 +113,6 @@ const mapStateToProps = (state: BaseState): SP => {
wellContents = wellContentsSelectors.getWellContentsAllLabware(state)[
labwareId
]
console.log('liquidplacementmodal', { wellContents })

return {
selectedWells,
Expand Down
7 changes: 4 additions & 3 deletions protocol-designer/src/components/steplist/SubstepRow.js
Expand Up @@ -43,12 +43,13 @@ export const PillTooltipContents = (
const hasMultipleIngreds = props.ingreds
? Object.keys(props.ingreds).length > 1
: false

return (
<div className={styles.liquid_tooltip_contents}>
<table>
<tbody>
{props.ingreds &&
map(props.ingreds, (ingred, groupId) => (
map(props.ingreds, (ingred: number, groupId): React.Node => (
<tr key={groupId} className={styles.ingred_row}>
<td>
<div
Expand All @@ -61,11 +62,11 @@ export const PillTooltipContents = (
</td>
{hasMultipleIngreds && (
<td className={styles.ingred_percentage}>
{formatPercentage(ingred.volume, totalLiquidVolume)}
{formatPercentage(ingred, totalLiquidVolume)}
</td>
)}
<td className={styles.ingred_partial_volume}>
{formatVolume(ingred.volume, 2)}µl
{formatVolume(ingred, 2)}µl
</td>
</tr>
))}
Expand Down
14 changes: 13 additions & 1 deletion protocol-designer/src/file-data/selectors/commands.js
Expand Up @@ -91,7 +91,19 @@ export const getInitialRobotState: BaseState => StepGeneration.RobotState = crea
moduleLocations: modules,
pipetteLocations: pipettes,
})
robotState.liquidState.labware = labwareLiquidState
// console.log('initial robot liq state, raw', {
// ...robotState.liquidState.labware,
// })

// TODO IMMEDIATELY: this SHOULD be adding only empty labware keys (eg `trashId: {}` is not in labwareLiquidState)
// Trace better and see if you can do it more elegantly.
// Before, it was `robotState.liquidState.labware = labwareLiquidState`
robotState.liquidState.labware = {
...robotState.liquidState.labware,
...labwareLiquidState,
}

// console.log('initial robot state', robotState)
return robotState
}
)
Expand Down
Expand Up @@ -58,8 +58,6 @@ export function dispenseUpdateLiquidState(
well
)
const liquidLabware = prevLiquidState.labware[labware]
// TODO IMMEDIATELY left off here
console.log('dispenseUpdateLiquidState', { liquidLabware })

// remove liquid from pipette tips,
// create intermediate object where sources are updated tip liquid states
Expand Down
20 changes: 10 additions & 10 deletions protocol-designer/src/top-selectors/well-contents/index.js
@@ -1,7 +1,6 @@
// @flow
import { createSelector } from 'reselect'
import isEmpty from 'lodash/isEmpty'
import mapValues from 'lodash/mapValues'
import min from 'lodash/min'
import pick from 'lodash/pick'
import reduce from 'lodash/reduce'
Expand Down Expand Up @@ -72,20 +71,21 @@ export const getAllWellContentsForActiveItem: Selector<WellContentsByLabware> =
timelineFrameBeforeActiveItem,
(labwareEntities, timelineFrame) => {
const liquidState = timelineFrame.robotState.liquidState.labware
const wellContentsByLabwareId = mapValues(
liquidState,
const wellContentsByLabwareId = Object.keys(labwareEntities).reduce(
(
labwareLiquids: StepGeneration.SingleLabwareLiquidState,
acc: WellContentsByLabware,
labwareId: string
) => {
const contentz = _wellContentsForLabware(
labwareLiquids,
): WellContentsByLabware => {
const liquids = liquidState[labwareId]
const contents = _wellContentsForLabware(
liquids,
labwareEntities[labwareId].def
)
console.log('getAllWellContentsForActiveItem', { contentz, labwareId })
return contentz
}
return { ...acc, [labwareId]: contents }
},
{}
)

return wellContentsByLabwareId
}
)
Expand Down

0 comments on commit bfd837a

Please sign in to comment.