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

Canvassing: Stepper component allows negative values #2377

Open
richardolsson opened this issue Nov 24, 2024 · 2 comments
Open

Canvassing: Stepper component allows negative values #2377

richardolsson opened this issue Nov 24, 2024 · 2 comments
Assignees
Labels
🐜 bug Something isn't working 🚪 entry-level Good for newcomers 🐟 Small Should be a quick-ish fix.

Comments

@richardolsson
Copy link
Member

Description

The new, experimental "canvassing" (door knocking, mailbox leafletting etc) feature in Zetkin contains a mobile-first UI for canvassers, that they use when out visiting places. The UI allows for creating places and households that are not yet documented.

The Stepper component is a UI widget in the new canvassing feature that is used, among other things, to increment/decrement the number of floors and households per floor when creating households.

In that UI, it should be disallowed to have values that are equal to or less than zero (since a house can't have zero floors, or zero households per floor).

Steps to reproduce

  1. First make sure that the instance you're using has canvassing features enabled, by setting the environment variable FEAT_AREAS=* (which enables for all organizations) in .env.local. This is already the case on the dev server, but won't be the case on localhost
  2. Resize your browser to be very small, e.g. 650px tall
  3. Go to https://app.dev.zetkin.org/my/canvassassignments
  4. Sign in using [email protected]
  5. Go into one of the canvass assignments
  6. Pan somewhere on the map and create a new place using the button at the bottom of the screen
  7. Give the place a name and submit
  8. In the new place, press "create many"
  9. Decrement the number of floors to zero or below

Expected Behaviour

Decrementing to zero or below should not be possible.

Actual Behaviour

Decrementing is allowed.

Screenshots (if you have any)

image

Proposed solution

The Stepper component should be given optional min and max values, and the min value should be set to 1 for both of these steppers.

@richardolsson richardolsson added 🐜 bug Something isn't working 🚪 entry-level Good for newcomers 🐟 Small Should be a quick-ish fix. labels Nov 24, 2024
@ziggabyte ziggabyte changed the title Stepper component allows negative values Canvassing: Stepper component allows negative values Nov 29, 2024
@nanoobop nanoobop self-assigned this Dec 7, 2024
@nanoobop
Copy link
Collaborator

nanoobop commented Dec 7, 2024

xd question. How do we distinguish the names of the floors? There are BV and KV and sometimes they are called -1 and -2.

@richardolsson
Copy link
Member Author

xd question. How do we distinguish the names of the floors? There are BV and KV and sometimes they are called -1 and -2.

That's a great question. We thought a lot about how to name things, and concluded that it's not possible for us to come up with one solution that will work everywhere. So we are leaving it up to the users (or their organization) to decide how to name things. When creating floors, Zetkin will automatically number them from 1, but that can be changed later.

In this context, for this issue, it doesn't really matter how they will be named, because the stepper is for the number of floors, and a building can't have a negative number of floors, or even zero. The same is true for households per floor, which can also not be less than one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐜 bug Something isn't working 🚪 entry-level Good for newcomers 🐟 Small Should be a quick-ish fix.
Projects
None yet
Development

No branches or pull requests

2 participants