now sorts by hangtime asc, limits to 24h
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user