diff --git a/README.md b/README.md index a9d22ca..c867c36 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,6 @@ the front page, smallest first. # TODO -* make that part about sorting not be a lie -* make that part about 48 hours not be a lie * continue to resist the urge to use the orange # Author diff --git a/hn/handlers.go b/hn/handlers.go index 3b519dc..b42a648 100644 --- a/hn/handlers.go +++ b/hn/handlers.go @@ -22,8 +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) var fpi []HNFrontPage - r.db.Where("disappeared is not ?", time.Time{}).Order("disappeared desc").Find(&fpi) + r.db.Where("disappeared is not ? and disappeared > ?", time.Time{}, fortyeightago).Order("(disappeared-appeared) desc").Find(&fpi) type fprow struct { Duration string