diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-07-14 02:25:12 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-07-14 02:25:12 +0200 |
commit | 1c3910befbe8d6679979ac43b00796ea58329dff (patch) | |
tree | c7c51535744b13e236bc1374b8e83bb4abae8a12 /skate | |
parent | b7202cc09b67f5a1e58576b9c0feac7baae387c2 (diff) | |
download | refcat-1c3910befbe8d6679979ac43b00796ea58329dff.tar.gz refcat-1c3910befbe8d6679979ac43b00796ea58329dff.zip |
reduce: fix off-by-one error
duplication detection required a +1 on the index in the ref document
Diffstat (limited to 'skate')
-rw-r--r-- | skate/reduce.go | 2 | ||||
-rw-r--r-- | skate/reduce_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/skate/reduce.go b/skate/reduce.go index eac2e83..01df50f 100644 --- a/skate/reduce.go +++ b/skate/reduce.go @@ -501,7 +501,7 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [ seen.Add(s) } for _, r := range refs { - s := r.Key + fmt.Sprintf("%d", r.Index) + s := r.Key + fmt.Sprintf("%d", r.Index+1) if seen.Contains(s) { stats.skipMatchedRef++ log.Printf("skip-matched-ref [%d]: from %d matches; ident=%v, title=%s, key=%v, index=%d", diff --git a/skate/reduce_test.go b/skate/reduce_test.go index 99c0ed7..da4e21e 100644 --- a/skate/reduce_test.go +++ b/skate/reduce_test.go @@ -215,7 +215,7 @@ func TestMatchedRefsExtend(t *testing.T) { Biblio: Biblio{ Title: "Title", }, - Index: 2, + Index: 1, Key: "K2", }, }, |