Name NLB uploads izpisek_YYYY-MM-DD

Back to the dashed date rename_izpiski.py used, so a statement the script
already named is recognised as already there when it is uploaded again,
rather than landing as a second copy under the underscored name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 22:49:41 +02:00
co-authored by Claude Opus 5.5
parent bd406a110d
commit ed52be3f1d
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -314,7 +314,7 @@ IBAN wrapped across continuation lines stays contiguous for a glob to match.
A new parser must do the same rather than reintroduce a structured field.
**A parser may name its statements, and only uploads use it.** `parser.Namer` is
optional, like `parser.Warner`: `nlb` names an izpisek `izpisek_YYYY_MM_DD`
optional, like `parser.Warner`: `nlb` names an izpisek `izpisek_YYYY-MM-DD`
after its *Datum izpiska*, ported from the `rename_izpiski.py` it replaced, and
`traderepublic` names a statement `traderepublic_YYYY_MM_DD_YYYY_MM_DD` after
the period in its header. A name is derived from what the statement says, never
+2 -2
View File
@@ -217,7 +217,7 @@ it does not create one.
Some banks name their downloads unhelpfully, so a parser may name the statement
instead — lowercase throughout, extension included — and the status line says
what each file became. An NLB izpisek is saved as `izpisek_YYYY_MM_DD.pdf` after
what each file became. An NLB izpisek is saved as `izpisek_YYYY-MM-DD.pdf` after
the *Datum izpiska* in its header, and a Trade Republic statement, which
downloads as `document-N.pdf`, as `traderepublic_YYYY_MM_DD_YYYY_MM_DD.pdf`
after the period on its first page (`DATE 01 May 2025 - 31 Jul 2026`). Either
@@ -679,7 +679,7 @@ nothing else to configure — `parser` names one of these and that is all.
| `parser` | Statement | Notes |
| --- | --- | --- |
| `nlb` | NLB izpisek PDF | Wrapped descriptions are folded in from continuation lines, and the IBAN column is appended to the description. Uploads are saved as `izpisek_YYYY_MM_DD.pdf` after the statement date. |
| `nlb` | NLB izpisek PDF | Wrapped descriptions are folded in from continuation lines, and the IBAN column is appended to the description. Uploads are saved as `izpisek_YYYY-MM-DD.pdf` after the statement date. |
| `traderepublic` | Trade Republic PDF | Handles both the single-line and the stacked layout by measuring column positions. Uploads are saved as `traderepublic_YYYY_MM_DD_YYYY_MM_DD.pdf` after the statement period. |
| `revolut` | `account-statement*.csv` | Skips non-COMPLETED rows, folds the fee into the amount. |
+2 -2
View File
@@ -65,7 +65,7 @@ func (p *nlbParser) Parse(path string, acc *config.Account) ([]RawTxn, error) {
return parseNLBText(text, p.digits)
}
// StatementName names an izpisek after its statement date, izpisek_YYYY_MM_DD,
// StatementName names an izpisek after its statement date, izpisek_YYYY-MM-DD,
// so the folder sorts by date and two downloads of one statement collide.
func (p *nlbParser) StatementName(path string) (string, error) {
text, err := pdfToText(path)
@@ -80,7 +80,7 @@ func nlbStatementName(text string) string {
if m == nil {
return ""
}
return fmt.Sprintf("izpisek_%s_%s_%s", m[3], m[2], m[1])
return fmt.Sprintf("izpisek_%s-%s-%s", m[3], m[2], m[1])
}
// parseNLBText holds the whole parser, separated from PDF extraction so it can
+2 -2
View File
@@ -117,8 +117,8 @@ func TestParseNLBRejectsMalformedLine(t *testing.T) {
func TestNLBStatementName(t *testing.T) {
header := " IZPISEK 001/2026\n" +
" Datum izpiska 31.01.2026 Stran 1\n"
if got := nlbStatementName(header + nlbPage); got != "izpisek_2026_01_31" {
t.Errorf("name = %q, want izpisek_2026_01_31", got)
if got := nlbStatementName(header + nlbPage); got != "izpisek_2026-01-31" {
t.Errorf("name = %q, want izpisek_2026-01-31", got)
}
if got := nlbStatementName(nlbPage); got != "" {
t.Errorf("name without a statement date = %q, want none", got)