From 8d1db5c15e6f197f1d595817f5f9bada7b1e7328 Mon Sep 17 00:00:00 2001 From: sneak Date: Sat, 28 Mar 2020 12:48:04 -0700 Subject: [PATCH] restore old sorting --- README.md | 9 ++++++--- hn/handlers.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c867c36..9c57989 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,12 @@ Live: https://orangesite.sneak.cloud -Shows stories that were on the orangesite front page within the last 48 -hours, but aren't any more. Sorted by the amount of time they remained on -the front page, smallest first. +Shows stories that were on the orangesite front page within the last 24 +hours, but aren't any more. Sorted by when they exited the frontpage, most +recent first. + +Stories on the frontpage for less than a half hour (likely manually +moderator nuked if rank > 25 or so) are marked red for convenience. # TODO diff --git a/hn/handlers.go b/hn/handlers.go index 2b6e2bd..f478913 100644 --- a/hn/handlers.go +++ b/hn/handlers.go @@ -24,7 +24,7 @@ func NewRequestHandlerSet(version string, db *gorm.DB) *RequestHandlerSet { func (r *RequestHandlerSet) indexHandler(c echo.Context) error { last24h := time.Now().Add(time.Second * 86400 * -1) var fpi []HNFrontPage - r.db.Where("disappeared is not ? and disappeared > ?", time.Time{}, last24h).Select("*, ( strftime('%s',disappeared) - strftime('%s',appeared)) as hangtime").Order("hangtime asc").Find(&fpi) + r.db.Where("disappeared is not ? and disappeared > ?", time.Time{}, last24h).Order("disappeared desc").Find(&fpi) type fprow struct { Duration string