From 3ccbb20a9e2d6591961722224a36764c3ce15eb5 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Sun, 26 Nov 2023 12:44:48 +0100 Subject: [PATCH] Fixed tracking import errors --- internal/models/models.go | 1 + internal/models/models_test.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/internal/models/models.go b/internal/models/models.go index 7500759..2175ea1 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -181,6 +181,7 @@ func (i *ImportResult) Update(from ImportResult) { i.TotalCount = from.TotalCount i.ImportCount = from.ImportCount i.UpdateTimestamp(from.LastTimestamp) + i.ImportErrors = append(i.ImportErrors, from.ImportErrors...) } type Progress struct { diff --git a/internal/models/models_test.go b/internal/models/models_test.go index da01c36..59cc4dd 100644 --- a/internal/models/models_test.go +++ b/internal/models/models_test.go @@ -121,16 +121,19 @@ func TestImportResultUpdate(t *testing.T) { TotalCount: 100, ImportCount: 20, LastTimestamp: time.Now(), + ImportErrors: []string{"foo"}, } newResult := models.ImportResult{ TotalCount: 120, ImportCount: 50, LastTimestamp: time.Now().Add(1 * time.Hour), + ImportErrors: []string{"bar"}, } result.Update(newResult) assert.Equal(t, 120, result.TotalCount) assert.Equal(t, 50, result.ImportCount) assert.Equal(t, newResult.LastTimestamp, result.LastTimestamp) + assert.Equal(t, []string{"foo", "bar"}, result.ImportErrors) } func TestImportResultUpdateTimestamp(t *testing.T) {