Switch to trap counts instead of inspections on the dash
Because we can show those on a map.
This commit is contained in:
parent
06140a9062
commit
f50f3892f2
2 changed files with 7 additions and 7 deletions
|
|
@ -35,7 +35,7 @@ type Config struct {
|
|||
|
||||
type ContextDashboard struct {
|
||||
Config Config
|
||||
CountInspections int
|
||||
CountTraps int
|
||||
CountMosquitoSources int
|
||||
CountServiceRequests int
|
||||
Geo template.JS
|
||||
|
|
@ -202,9 +202,9 @@ func dashboard(ctx context.Context, w http.ResponseWriter, user *models.User) {
|
|||
lastSync = &sync.Created
|
||||
}
|
||||
is_syncing := background.IsSyncOngoing(org.ID)
|
||||
inspectionCount, err := org.Mosquitoinspections().Count(ctx, db.PGInstance.BobDB)
|
||||
trapCount, err := org.Traplocations().Count(ctx, db.PGInstance.BobDB)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to get inspection count", err, http.StatusInternalServerError)
|
||||
respondError(w, "Failed to get trap count", err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
sourceCount, err := org.Pointlocations().Count(ctx, db.PGInstance.BobDB)
|
||||
|
|
@ -240,7 +240,7 @@ func dashboard(ctx context.Context, w http.ResponseWriter, user *models.User) {
|
|||
Config: Config{
|
||||
URLTegola: config.URLTegola,
|
||||
},
|
||||
CountInspections: int(inspectionCount),
|
||||
CountTraps: int(trapCount),
|
||||
CountMosquitoSources: int(sourceCount),
|
||||
CountServiceRequests: int(serviceCount),
|
||||
IsSyncOngoing: is_syncing,
|
||||
|
|
|
|||
|
|
@ -249,11 +249,11 @@ body {
|
|||
<div class="metric-icon bg-success bg-opacity-10 text-success">
|
||||
<i class="fas fa-clipboard-check"></i>
|
||||
</div>
|
||||
<h5 class="card-title">Inspections</h5>
|
||||
<h5 class="card-title">Traps</h5>
|
||||
{{ if .IsSyncOngoing }}
|
||||
<p class="metric-value">{{ .CountInspections | bigNumber }}...?</p>
|
||||
<p class="metric-value">{{ .CountTraps | bigNumber }}...?</p>
|
||||
{{ else }}
|
||||
<p class="metric-value">{{ .CountInspections | bigNumber }}</p>
|
||||
<p class="metric-value">{{ .CountTraps | bigNumber }}</p>
|
||||
{{ end }}
|
||||
<!-- <p class="card-text text-muted">
|
||||
<span class="text-success">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue