diff --git a/hn/handlers.go b/hn/handlers.go index b42a648..2b6e2bd 100644 --- a/hn/handlers.go +++ b/hn/handlers.go @@ -22,9 +22,9 @@ func NewRequestHandlerSet(version string, db *gorm.DB) *RequestHandlerSet { } func (r *RequestHandlerSet) indexHandler(c echo.Context) error { - fortyeightago := time.Now().Add(time.Second * 86400 * 2 * -1) + last24h := time.Now().Add(time.Second * 86400 * -1) var fpi []HNFrontPage - r.db.Where("disappeared is not ? and disappeared > ?", time.Time{}, fortyeightago).Order("(disappeared-appeared) desc").Find(&fpi) + 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) type fprow struct { Duration string diff --git a/view/index.html b/view/index.html index 0c0fe19..dfb3567 100644 --- a/view/index.html +++ b/view/index.html @@ -4,7 +4,7 @@