Commit 2e081c5
committed
fix: keep all digits when formatting 13-digit SP/MG voter ids
format_voter_id used hardcoded 12-digit forward slices, so a valid 13-digit
voter id (the SP/MG edge case with a 9-digit sequential number) lost its last
digit and showed the wrong federative union and verifying digits, even though
is_valid accepts it.
Slice length-aware: the federative union and verifying digits are always the
last four characters (via the existing backward-indexing helpers), and the
sequential number is everything before them. 12-digit output is unchanged;
13-digit ids now format losslessly.1 parent e1ce34a commit 2e081c5
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
293 | 303 | | |
294 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
295 | 308 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
130 | 140 | | |
131 | 141 | | |
132 | 142 | | |
0 commit comments