diff options
author | 2020-06-23 18:41:38 +0200 | |
---|---|---|
committer | 2020-06-23 18:41:38 +0200 | |
commit | 5fb992caddd6a3694629ff12219a22135fb19d85 (patch) | |
tree | 82e54dfd069d3c8a911cfaa270fb2d663353a784 | |
parent | Speed up loading the threads for a list (diff) | |
download | archives-5fb992caddd6a3694629ff12219a22135fb19d85.tar.gz archives-5fb992caddd6a3694629ff12219a22135fb19d85.tar.bz2 archives-5fb992caddd6a3694629ff12219a22135fb19d85.zip |
Speed up computation of /{{listname}}/
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r-- | pkg/app/list/show.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/pkg/app/list/show.go b/pkg/app/list/show.go index 79ea8f2..db5f237 100644 --- a/pkg/app/list/show.go +++ b/pkg/app/list/show.go @@ -4,7 +4,6 @@ import ( "archives/pkg/cache" "archives/pkg/database" "archives/pkg/models" - "github.com/go-pg/pg/v10/orm" "net/http" "strings" ) @@ -26,11 +25,7 @@ func ComputeShowTemplateData(listName string) interface{} { MessageCount int } err := database.DBCon.Model((*models.Message)(nil)). - WhereGroup(func(q *orm.Query) (*orm.Query, error) { - q = q.WhereOr(`subject LIKE '[` + listName + `]%'`). - WhereOr(`subject LIKE 'Re: [` + listName + `]%'`) - return q, nil - }). + Where("list = ?", listName). ColumnExpr("to_char(date, 'YYYY-MM') AS combined_date"). ColumnExpr("count(*) AS message_count"). Group("combined_date"). |