Better string formatting for the internal analytics endpoint

This commit is contained in:
David Dworken 2022-10-04 12:58:00 -07:00
parent 6fe2257313
commit 68416f9d0f

View File

@ -114,8 +114,9 @@ func usageStatsHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
versions = strings.ReplaceAll(versions, "Unknown", "") versions = strings.ReplaceAll(strings.ReplaceAll(versions, "Unknown", ""), ", ", "")
tbl.AddRow(registrationDate.Format("2006-01-02"), numDevices, numEntries, numQueries, lastUsedDate.Format("2006-01-02"), lastQueried.Format("2006-01-02"), versions, ipAddresses) lastQueryStr := strings.ReplaceAll(lastQueried.Format("2006-01-02"), "1970-01-01", "")
tbl.AddRow(registrationDate.Format("2006-01-02"), numDevices, numEntries, numQueries, lastUsedDate.Format("2006-01-02"), lastQueryStr, versions, ipAddresses)
} }
tbl.Print() tbl.Print()
} }