implement 48h limit and sort by hangtime asc
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jeffrey Paul 2020-03-28 10:20:47 -07:00
parent c35608476f
commit 0cf05a0312
2 changed files with 2 additions and 3 deletions

View File

@ -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

View File

@ -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