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:
parent
0cf05a0312
commit
51a0954b27
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="col-lg-12">
|
||||
|
||||
|
||||
<h2>Links Exiting The Front Page</h2>
|
||||
<h2>Links Exiting The Front Page <small>(last 24h)</small></h2>
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
|
Loading…
Reference in New Issue
Block a user