aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-03-20 22:03:58 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2024-03-20 22:14:31 +0200
commitb3af97293aaa47c39fc3ae9fcabd2c67ca332d23 (patch)
tree5cfb2844a2265d3bf0e28e7645f03e5a49642dcd /pkg/app/handler/maintainer/show.go
parentdb: when logging query, also log the duration (diff)
downloadsoko-b3af97293aaa47c39fc3ae9fcabd2c67ca332d23.tar.gz
soko-b3af97293aaa47c39fc3ae9fcabd2c67ca332d23.tar.bz2
soko-b3af97293aaa47c39fc3ae9fcabd2c67ca332d23.zip
app/category: optimize and simplify the show
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'pkg/app/handler/maintainer/show.go')
-rw-r--r--pkg/app/handler/maintainer/show.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/pkg/app/handler/maintainer/show.go b/pkg/app/handler/maintainer/show.go
index 981a5c6..5f05382 100644
--- a/pkg/app/handler/maintainer/show.go
+++ b/pkg/app/handler/maintainer/show.go
@@ -261,17 +261,18 @@ func ShowStabilizationFile(w http.ResponseWriter, r *http.Request) {
}
pageName := r.URL.Path[strings.LastIndexByte(r.URL.Path, '/')+1:]
- var gpackages []*models.Package
- err = query.Model(&gpackages).
- Relation("Versions").
- Relation("Versions.PkgCheckResults", func(q *pg.Query) (*pg.Query, error) {
- return q.Where("class = ?", "StableRequest"), nil
- }).Select()
+ var results []*models.PkgCheckResult
+ err = database.DBCon.Model(&results).
+ Column("atom", "cpv", "message").
+ Where("class = ?", "StableRequest").
+ Where("atom IN (?)", query).
+ OrderExpr("cpv").
+ Select()
if err != nil {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
- utils.StabilizationExport(w, pageName, gpackages)
+ utils.StabilizationExport(w, pageName, results)
}
func ShowStabilizationFeed(w http.ResponseWriter, r *http.Request) {