From d053dab402756e16a4458e65b617b8dc3714bbb2 Mon Sep 17 00:00:00 2001 From: ayame-git Date: Fri, 5 May 2017 10:18:24 +0300 Subject: [PATCH] fixed padding and filtered missing hashes --- css/style.css | 2 +- models.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/css/style.css b/css/style.css index ecf5dd83..9772088c 100644 --- a/css/style.css +++ b/css/style.css @@ -21,7 +21,7 @@ nav#mainmenu a { color: white; } div#container { - padding-top: 7rem; + padding-top: 10rem; } body { diff --git a/models.go b/models.go index b04400d6..1a0381bb 100644 --- a/models.go +++ b/models.go @@ -131,13 +131,14 @@ func getTorrentsOrderBy(parameters *WhereParams, orderBy string, limit int, offs var torrents []Torrents var dbQuery *gorm.DB var count int + conditions := "torrent_hash is not null" //filter out broken entries + var params []interface{} if parameters != nil { // if there is where parameters - db.Model(&torrents).Where(parameters.conditions, parameters.params...).Count(&count) - dbQuery = db.Model(&torrents).Where(parameters.conditions, parameters.params...) - } else { - db.Model(&torrents).Count(&count) - dbQuery = db.Model(&torrents) + conditions += " AND " + parameters.conditions + params = parameters.params } + db.Model(&torrents).Where(conditions, params...).Count(&count) + dbQuery = db.Model(&torrents).Where(conditions, params...) if orderBy == "" { orderBy = "torrent_id DESC"