Invoice generator: the next number adds `INV` to plain numbers and changes the padding
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 94/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- next.js, react, typescript
- Área
- frontend
Línea de trabajo
Empieza por nextInvoiceNumber en lib/invoice-types.ts y luego revisa los casos existentes en lib/__tests__/invoice-types.test.ts. Añade cobertura para cada ejemplo, el caso de crecimiento de ancho y el valor predeterminado para una lista vacía; después ejecuta npm run lint, npm run test y npm run build. Los puntos de llamada del cliente del generador de facturas no deberían necesitar cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
nextInvoiceNumber (lib/invoice-types.ts, line 159) is meant to keep the prefix and zero padding of the highest saved invoice (its comment, lines 154 to 157), but:
| Highest saved number | Next number now | Expected |
|---|---|---|
1001 |
INV1002 |
1002 |
INV-07 |
INV-0008 |
INV-08 |
A1 |
A0002 |
A2 |
2026-001 |
2026-0002 |
2026-002 |
999 |
INV1000 |
1000 |
INV0007 |
INV0008 |
INV0008 (already right) |
An empty prefix is falsy, so match[1] || fallbackPrefix (line 169) swaps it for INV, and Math.max(pad, match[2].length) (line 170) pads every number to at least 4 digits. On the invoice generator you see it when you save an invoice numbered 1001 and click New.
What to do
- Keep the prefix as it is, even when it's empty, and pad to the width of the highest number's digits (
match[2].length). - Use
INVand 4 digits only for an empty list, so it still starts atINV0001. - A number that outgrows its width just gets longer:
INV-99givesINV-100.
Where to look
lib/invoice-types.ts:nextInvoiceNumber(lines 154 to 174)lib/__tests__/invoice-types.test.ts: thenextInvoiceNumbertests (line 75)- The client calls it in several places (
InvoiceGeneratorClient.tsx, lines 58, 65, 70, 76, 105 and 130), and none of them need to change.
Acceptance criteria
- Every row in the table gives the expected number,
INV-99givesINV-100, and an empty list still givesINV0001 - Tests for these cases (the ones that change fail on the current code)
-
npm run lint,npm run testandnpm run buildpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #220 in the description.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1
- Forks
- 9
- Merge medio
- 10 h 24 min
- PR fusionados (30 d)
- 93
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/toolbelt
-
bug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
bug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
Stop the JSON formatter's Find bar from typing into the JSONPosiblemente ocupada @kudala-bharani la tomó hace 2 días. Abiertobug hacktoberfest help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
codercops/toolbelt#121 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
JSON formatter: a duplicate key crashes the whole toolPosiblemente ocupada @lb1192176991-lab la tomó hace 1 día. Abiertobug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
codercops/toolbelt#218 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
JSON to XML: keys like `@type`, `$ref` or `bad key` turn into `<item>`Posiblemente ocupada @AyanZahid-Code la tomó hace 1 día. Abiertobug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
codercops/toolbelt#214 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/toolbelt
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
paperclipai/paperclip#17151 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
AgoraIO-Extensions/agent-infra#3159 ·
Los mantenedores suelen responder en 1 día
-
blocklist addition
Dificultad 1/5 Menos de una hora Aptitud para principiantes 66/100
MetaMask/eth-phishing-detect#304596 ·
Los mantenedores suelen responder en 1 día
-
friction
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
kentcdodds/kody#4142 ·
-
[Bug] Statistics | Task statistics are always empty on MikroORM with MySQL or SQLitePosiblemente ocupada @NdekoCode la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ever-co/ever-gauzy#11214 ·
Los mantenedores suelen responder en 1 día