diff --git a/html/template/sync/pool-by-id.html b/html/template/sync/pool-by-id.html index 3f3ab447..856dcfa6 100644 --- a/html/template/sync/pool-by-id.html +++ b/html/template/sync/pool-by-id.html @@ -30,7 +30,7 @@
-

45

+

{{ .Upload.CountExisting }}

Existing Pools

Matches found in previous records

@@ -39,7 +39,7 @@
-

23

+

{{ .Upload.CountNew }}

New Pools

Not found in existing records

diff --git a/platform/pool.go b/platform/pool.go index 5c6db680..7f98ed88 100644 --- a/platform/pool.go +++ b/platform/pool.go @@ -20,11 +20,13 @@ import ( ) type UploadPoolDetail struct { - Created time.Time - ID int32 - Name string - Pools []UploadPoolRow - Status string + CountExisting int + CountNew int + Created time.Time + ID int32 + Name string + Pools []UploadPoolRow + Status string } type UploadPoolRow struct { Street string @@ -91,16 +93,25 @@ func GetUploadPoolDetail(ctx context.Context, organization_id int32, file_id int return UploadPoolDetail{}, fmt.Errorf("Failed to query pools for %d: %w", file_id, err) } pools := make([]UploadPoolRow, 0) + count_existing := 0 + count_new := 0 for _, r := range rows { + if r.IsNew { + count_new = count_new + 1 + } else { + count_existing = count_existing + 1 + } pools = append(pools, UploadPoolRow{ Street: r.AddressStreet, City: r.AddressCity, }) } return UploadPoolDetail{ - Name: file.Name, - Pools: pools, - Status: file.Status.String(), + CountExisting: count_existing, + CountNew: count_new, + Name: file.Name, + Pools: pools, + Status: file.Status.String(), }, nil } func PoolUploadList(ctx context.Context, organization_id int32) ([]PoolUpload, error) {