Count existing and new pool rows
This commit is contained in:
parent
515dbb54fa
commit
f00436b136
2 changed files with 21 additions and 10 deletions
|
|
@ -30,7 +30,7 @@
|
|||
<div class="col-md-4">
|
||||
<div class="card summary-card h-100 border-primary">
|
||||
<div class="card-body text-center">
|
||||
<h1 class="display-4 text-primary">45</h1>
|
||||
<h1 class="display-4 text-primary">{{ .Upload.CountExisting }}</h1>
|
||||
<h5>Existing Pools</h5>
|
||||
<p class="text-muted">Matches found in previous records</p>
|
||||
</div>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<div class="col-md-4">
|
||||
<div class="card summary-card h-100 border-success">
|
||||
<div class="card-body text-center">
|
||||
<h1 class="display-4 text-success">23</h1>
|
||||
<h1 class="display-4 text-success">{{ .Upload.CountNew }}</h1>
|
||||
<h5>New Pools</h5>
|
||||
<p class="text-muted">Not found in existing records</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import (
|
|||
)
|
||||
|
||||
type UploadPoolDetail struct {
|
||||
CountExisting int
|
||||
CountNew int
|
||||
Created time.Time
|
||||
ID int32
|
||||
Name string
|
||||
|
|
@ -91,13 +93,22 @@ 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{
|
||||
CountExisting: count_existing,
|
||||
CountNew: count_new,
|
||||
Name: file.Name,
|
||||
Pools: pools,
|
||||
Status: file.Status.String(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue