implement 48h limit and sort by hangtime asc
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:
parent
c35608476f
commit
0cf05a0312
@ -8,8 +8,6 @@ the front page, smallest first.
|
|||||||
|
|
||||||
# TODO
|
# 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
|
* continue to resist the urge to use the orange
|
||||||
|
|
||||||
# Author
|
# Author
|
||||||
|
@ -22,8 +22,9 @@ func NewRequestHandlerSet(version string, db *gorm.DB) *RequestHandlerSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *RequestHandlerSet) indexHandler(c echo.Context) error {
|
func (r *RequestHandlerSet) indexHandler(c echo.Context) error {
|
||||||
|
fortyeightago := time.Now().Add(time.Second * 86400 * 2 * -1)
|
||||||
var fpi []HNFrontPage
|
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 {
|
type fprow struct {
|
||||||
Duration string
|
Duration string
|
||||||
|
Loading…
Reference in New Issue
Block a user