Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show age mouseover as time.Duration instead of static date #47

Merged
merged 1 commit into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/site/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ type Page struct {
TotalShown int
Types string
UniqueItems []*hubbub.Conversation
ResultAge time.Duration

Player int
Players int
Expand Down Expand Up @@ -276,6 +277,7 @@ func (h *Handlers) Collection() http.HandlerFunc {
Warning: warning,
UniqueItems: uniqueFiltered,
GetVars: getVars,
ResultAge: time.Since(result.Time),
}

for _, s := range sts {
Expand Down
2 changes: 1 addition & 1 deletion site/collection.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="navbar-center">
<div class="right-item">
<div class="tab-link"><a href="#" title="open in new tabs" onclick="openAllTabs(); return false;"><i class="fas fa-external-link-alt"></i></a></div>
<span title="Data as of {{.CollectionResult.Time }}">{{ if eq .TotalShown .Total }}{{ .Total }} unique items{{ else }}Showing {{ .TotalShown }} of {{ .Total}} unique items{{ end }},
<span title="Data as of {{ .ResultAge }} ago">{{ if eq .TotalShown .Total }}{{ .Total }} unique items{{ else }}Showing {{ .TotalShown }} of {{ .Total}} unique items{{ end }},
Avg age: {{ .CollectionResult.AvgAge | toDays }},
Avg wait: {{ .CollectionResult.AvgCurrentHold | toDays }}
</span>
Expand Down