Invoice generator: the next number adds `INV` to plain numbers and changes the padding
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 94/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- next.js, react, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu với nextInvoiceNumber trong lib/invoice-types.ts, sau đó xem lại các trường hợp hiện có trong lib/__tests__/invoice-types.test.ts. Bổ sung phạm vi kiểm thử cho mọi ví dụ, trường hợp độ rộng tăng lên và giá trị mặc định cho danh sách rỗng, sau đó chạy npm run lint, npm run test và npm run build; các điểm gọi phía client của invoice generator không nên yêu cầu thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 1
- Fork
- 9
- Merge trung bình
- 7 giờ 54 phút
- Pull request đã merge (30 ngày)
- 165
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/toolbelt
-
UUID generator's v7 batch comes out in random order instead of time orderCó thể đã có người làm @omisha123 đã nhận 5 ngày trước. Đang mởbug good first issue hacktoberfest
codercops/toolbelt#316 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Guide: how to convert a Unix timestamp to a date and backCó thể đã có người làm @varun-pahuja đã nhận 5 ngày trước. Đang mởdocumentation good first issue hacktoberfest seo
codercops/toolbelt#275 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hacktoberfest 2026: start hereĐang mởhacktoberfest
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
codercops/toolbelt#101 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[admin] Quarterly content-refresh routineCó thể làm lại được @anurag629 đã nhận 109 ngày trước và không có pull request nào đang mở. Đang mởadmin-only seo
codercops/toolbelt#47 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[admin] Repurpose guides to dev communities and socialCó thể làm lại được @anurag629 đã nhận 109 ngày trước và không có pull request nào đang mở. Đang mởadmin-only seo
codercops/toolbelt#44 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/toolbelt
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
b310-digital/teammapper#1515 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
OneNote: import empty sectionsĐang mởonenote
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
obsidianmd/obsidian-importer#689 ·
-
In a half-screen window, the title bar cuts the workspace and version names until they can't be readĐang mởbug launch local use macOS Windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Integration]: eRPCĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ava-labs/builders-hub#4826 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
记忆分析的默认模型显示与实际使用不一致Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày