From 8554b5f535694a4e0e09ef3497b4f13c82b6cb69 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 14 Mar 2016 14:50:29 -0400 Subject: [PATCH] Time edited doesn't show ns --- routes.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/routes.go b/routes.go index 0e57fde..1d5db91 100644 --- a/routes.go +++ b/routes.go @@ -111,6 +111,10 @@ func editNote(c *gin.Context) { c.Redirect(302, "/"+title+"/view") } numRows := len(strings.Split(currentText, "\n")) + 10 + totalTimeString := totalTime.String() + if totalTime.Seconds() < 1 { + totalTimeString = "< 1 s" + } c.HTML(http.StatusOK, "index.tmpl", gin.H{ "Title": title, "WikiName": RuntimeArgs.WikiName, @@ -118,7 +122,7 @@ func editNote(c *gin.Context) { "CurrentText": currentText, "NumRows": numRows, "Versions": versions, - "TotalTime": totalTime, + "TotalTime": totalTimeString, "SocketType": RuntimeArgs.Socket, "NoEdit": !currentVersion, }) @@ -194,13 +198,16 @@ func renderMarkdown(c *gin.Context, currentText string, title string, versions [ html2 = strings.Replace(html2, "&#91;", "[", -1) html2 = strings.Replace(html2, "&#93;", "]", -1) html2 = strings.Replace(html2, "&35;", "#", -1) - + totalTimeString := totalTime.String() + if totalTime.Seconds() < 1 { + totalTimeString = "< 1 s" + } c.HTML(http.StatusOK, "view.tmpl", gin.H{ "Title": title, "WikiName": RuntimeArgs.WikiName, "Body": template.HTML([]byte(html2)), "Versions": versions, - "TotalTime": totalTime.String(), + "TotalTime": totalTimeString, "AdminKey": AdminKey, "Encrypted": encrypted, "Prompt": noprompt,