Compare commits

...

2 Commits

Author SHA1 Message Date
Jeffrey Paul 51a0954b27 now sorts by hangtime asc, limits to 24h
continuous-integration/drone/push Build is passing Details
2020-03-28 10:54:00 -07:00
Jeffrey Paul 0cf05a0312 implement 48h limit and sort by hangtime asc
continuous-integration/drone/push Build is passing Details
2020-03-28 10:20:47 -07:00
3 changed files with 3 additions and 4 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 {
last24h := time.Now().Add(time.Second * 86400 * -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{}, last24h).Select("*, ( strftime('%s',disappeared) - strftime('%s',appeared)) as hangtime").Order("hangtime asc").Find(&fpi)
type fprow struct {
Duration string

View File

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