summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web/handlers.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go
index 0a7be55..6901661 100644
--- a/cmd/web/handlers.go
+++ b/cmd/web/handlers.go
@@ -18,15 +18,20 @@ func (app *application) listOperations(w http.ResponseWriter, r *http.Request) {
return
}
- var esses []models.EngagementStrategy
+ var newOps []models.Operation
for _, op := range ops {
- es, err := app.engagement_strategies.GetForOperation(op.ID)
+ esses, err := app.engagement_strategies.GetForOperation(op.ID)
// TODO: Check what kind of error this is, don't just continue
if err != nil {
continue
}
- esses = append(esses, es)
+ if len(esses) > 0 {
+ op.EngagementStrategies = esses
+ newOps = append(newOps, op)
+ } else {
+ newOps = append(newOps, op)
+ }
}
files := []string{
@@ -42,7 +47,7 @@ func (app *application) listOperations(w http.ResponseWriter, r *http.Request) {
}
data := operationsTemplateData{
- Operations: ops,
+ Operations: newOps,
}
err = ts.ExecuteTemplate(w, "base", data)