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

refactor(protocol-designer): tweak when module cards are disabled in … #14995

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

jerader
Copy link
Collaborator

@jerader jerader commented Apr 24, 2024

…createFileWizard

closes AUTH-369

Overview

There were 2 things that the getIsSlotAvailable logic did not account for and it is

  1. the TC taking up 2 slots
  2. the magnetic block not taking up any slots

This pr fixes that and adds test coverage

Test Plan

I have good unit testing for this so main priority is reviewing the logic

If you want, turn on the MoaM feature flag and create a flex protocol On the "Additional Items" page, add 6 temperature modules and see that the TC is disabled since there is only 1 slot available. Add another module and see that all modules + waste chute slot cards are disabled except for the magnetic block (this is because it is placed in an inner deck slot)

Changelog

  • rename util and refactor to return number of available slots
  • add support for TC and magnetic block

Review requests

see test plan

Risk assessment

low

@jerader jerader requested a review from a team as a code owner April 24, 2024 16:31
@jerader jerader requested review from koji and ncdiehl11 and removed request for a team April 24, 2024 16:31
const hasMagneticBlock = Object.values(modules || {}).some(
module => module.type === MAGNETIC_BLOCK_TYPE
)
let filteredModuleLength = moduleLength
Copy link
Contributor

Choose a reason for hiding this comment

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

nit
moduleLength is not used by anything except filteredModuleLength

let filteredModuleLength = modules != null ? Object.keys(modules).length : 0

Copy link
Contributor

@koji koji left a comment

Choose a reason for hiding this comment

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

left a comment but it is nit.
The logic looks good to me.

@jerader jerader merged commit 972c970 into edge Apr 24, 2024
14 checks passed
@jerader jerader deleted the pd_fix-tc-logic branch April 24, 2024 17:42
Carlos-fernandez pushed a commit that referenced this pull request May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants