From 8a8137fd582304ac8816b269d37a7eb46c231a00 Mon Sep 17 00:00:00 2001 From: kilo Date: Wed, 18 Oct 2017 05:46:58 +0200 Subject: [PATCH] Make old navigation use user torrent search route when needed (#1678) * Update template_functions.go * Update listing.jet.html * Update oldNav.jet.html * Update template_functions_test.go * Update template_functions_test.go * Update view.jet.html * Update torrent.go --- models/torrent.go | 4 ++-- .../layouts/partials/helpers/oldNav.jet.html | 22 +++++++++---------- templates/site/torrents/listing.jet.html | 12 +++++----- templates/site/torrents/view.jet.html | 4 +++- templates/template_functions.go | 8 +++---- templates/template_functions_test.go | 4 ++-- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/models/torrent.go b/models/torrent.go index af5b1f1a..9f8676b1 100644 --- a/models/torrent.go +++ b/models/torrent.go @@ -357,9 +357,9 @@ func (t *Torrent) ToJSON() TorrentJSON { statsObsolete[0] = true //The displayed stats are obsolete, S/D/L will show "Unknown" } - if time.Since(scrape.LastScrape).Hours() > 730 || (scrape.Seeders == 0 && scrape.Leechers == 0 && scrape.Completed == 0 && time.Since(scrape.LastScrape).Hours() > 12) { + if time.Since(scrape.LastScrape).Hours() > 730 || (scrape.Seeders == 0 && scrape.Leechers == 0 && scrape.Completed == 0 && time.Since(scrape.LastScrape).Hours() >= 1) { statsObsolete[1] = true - //The stats need to be refreshed, either because they are valid and older than one months (not as reliable) OR if they are unknown but have been scraped more than 12h ago + //The stats need to be refreshed, either because they are valid and older than one month (not that reliable) OR if they are unknown but have been scraped 1h (or more) ago } t.ParseLanguages() diff --git a/templates/layouts/partials/helpers/oldNav.jet.html b/templates/layouts/partials/helpers/oldNav.jet.html index 72582fd3..ba1a09b9 100644 --- a/templates/layouts/partials/helpers/oldNav.jet.html +++ b/templates/layouts/partials/helpers/oldNav.jet.html @@ -1,10 +1,10 @@
- + {{ range _, cat := GetCategories(true, false) }} - + {{ if _ % 3 == 2}} @@ -20,7 +20,7 @@ {{ range _, cat := GetCategory(Search.Category[:1], true)}} {{if Search.Category == cat.ID}}{{ T(cat.Name) }}{{else}} - {{ T(cat.Name)}}{{end}} + {{ T(cat.Name)}}{{end}} {{end}} @@ -29,17 +29,17 @@ diff --git a/templates/site/torrents/listing.jet.html b/templates/site/torrents/listing.jet.html index cd629c17..08853b54 100644 --- a/templates/site/torrents/listing.jet.html +++ b/templates/site/torrents/listing.jet.html @@ -18,35 +18,35 @@ {{end}} - + -