Skip to content

Unit style percentages can exceed 100% #306

@atomtay

Description

@atomtay

Describe the bug
Users can input more units via Unit Styles than present in Unit Types, and there are no validation checks to prevent this. As a result, it is possible to input impossible values ("200% of units in this development are studios")

Steps to reproduce
Walk us through how you revealed the bug.

  1. Go to 'Create a development'
  2. Scroll to "development type" and select Residential
  3. Enter 1 in each of the four Unit Type fields
  4. Enter 5 into one of the three Unit Style fields
  5. See that the percentage for that field is 125% (5 units out of 4)

Expected behavior
The percentages for Unit Styles should add up to 100%, and users should not be able to write in more units in the Unit Styles than they have in the above Unit Types section.

Screenshots
Example of what should be an invalid input:
invalid state

Example of what could be a valid input:
valid state

Desktop (please complete the following information):

  • OS: MacOS Catalina
  • Browser Firefox
  • Version 82.0.03

Additional context
The denominator should always be the number of units dictated in the Unit Type section. The numerator (the total number of units accounted for in Unit Styles) should not be able to exceed this for the math to work out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions