tools: the quantity rule is written twice — and the two disagree about a blank field
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Read src/components/manage/ToolDetail.tsx and src/engine/cnc/registerCutter.ts to compare how each handles a blank quantity, then check houseClient.InventoryItemSchema for the service's rule. The first step is a maintainer decision on whether a blank field should be refused or read as one, since the issue says that choice is still open. Done means one shared quantity rule and one shared error message, imported by both files, with the blank-field reasoning written down.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Found while implementing #309. The inventory quantity rule is written twice, in two different shapes, and the two do not agree about a blank field.
src/components/manage/ToolDetail.tsx (the inventory editor, #311's surface):
const qty = Number(quantity);
const qtyOk = Number.isInteger(qty) && qty > 0;
src/engine/cnc/registerCutter.ts (#309):
export function quantityOrOne(value: string): number { … } // blank is ONE
export function quantityProblem(value: string): string | null
The divergence is the blank field. Number('') is 0, so the editor refuses an empty field; quantityOrOne reads blank as one ("a user holding the box has at least one"). Both are defensible in their own context — a save that edits a known count should not guess, a registration is going the other way — but that reasoning is nowhere on the page, so the same empty box behaves differently in two places two clicks apart, and neither comment mentions the other.
The failure message is also duplicated verbatim: 'A quantity is a whole number of cutters, one or more' is hard-coded in ToolDetail.tsx's button title and returned by quantityProblem.
Do — decide which behaviour is right for an empty field, write the reason down, and leave one implementation of the rule and one spelling of its sentence, imported by both. houseClient.InventoryItemSchema (positive integer) is the thing both are approximating; the service is the authority, and it is the same one at both ends.
Not urgent, and not folded into #309 — changing the editor's blank behaviour is a visible change to #311's surface, which is out of a register-cutter issue's scope.
- Lingua principale
- TypeScript
- Stelle
- 2
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SlyWombat/CaseMaker
-
fabrication ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug ready
Difficoltà 4/5 1-2 giorni Idoneità per principianti 42/100
-
Three e2e reds left at 966-collapse after #1032 (bossThread848, engrave:206, engraveMeasuredPick:43)Apertabug ready
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug fabrication ready
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
-
fabrication ready
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Tutte le issue di SlyWombat/CaseMaker
Issue simili
-
area:frontend kind:bug priority:p2 ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
handsontable/hyperformula#1879 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
RunestoneInteractive/rs#1661 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
capricorn86/happy-dom#2594 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno