Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): Fix modules not populating the modules card #3278

Merged
merged 2 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/opentrons/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, module, context=None):
self.id = id(module)
if isinstance(module, labware.ModuleGeometry):
self.name = module.load_name
self.slow = module.parent
self.slot = module.parent
else:
self.name = module.get_name()
self.slot = module.parent.get_name()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type Props = {
}

export default function ModulesCardContents (props: Props) {
const {modules, showThermo} = props
if (!modules || !modules[0] || !showThermo) return <NoModulesMessage />
const {modules} = props
Copy link
Contributor

@mcous mcous Mar 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To preserve intended functionality, could we consider this change instead?

// ...
import filter from 'lodash/filter'
// ...
export default function ModulesCardContents (props: Props) {
  const {showThermo} = props
  const modules = filter(props.modules, m => {
    return showThermo || m.name !== 'thermocycler'
  })

  if (modules.length === 0) return <NoModulesMessage />

  return (
    <React.Fragment>
      {modules.map((mod, index) => (
        <ModuleItem module={mod} key={index} />
      ))}
    </React.Fragment>
  )
}

if (!modules || !modules[0]) return <NoModulesMessage />

return (
<React.Fragment>
Expand Down