hashtag - Add a 'week' search range.
Bug: skia:9559
Change-Id: I6bc79d4e437ffb1ffa2515cf096c5429cdad6d35
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/255579
Auto-Submit: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
diff --git a/hashtag/go/hashtag/main.go b/hashtag/go/hashtag/main.go
index 88d1fed..f36adb1 100644
--- a/hashtag/go/hashtag/main.go
+++ b/hashtag/go/hashtag/main.go
@@ -172,6 +172,8 @@
switch r.FormValue("range") {
case "":
// Don't do anything, the default is to search across all time.
+ case "7":
+ query.Begin = now.Add(-1 * time.Hour * 24 * 7)
case "30":
query.Begin = now.Add(-1 * time.Hour * 24 * 30)
case "90":
diff --git a/hashtag/pages/index.html b/hashtag/pages/index.html
index b2c2ebf..10e1e36 100644
--- a/hashtag/pages/index.html
+++ b/hashtag/pages/index.html
@@ -55,14 +55,11 @@
<section class=range>
<h3>Range</h3>
<label><input type=radio name=range value="" {% if eq .Form.Range "" %} checked {% end %}>All time</label>
- <label><input type=radio name=range value=30 {% if eq .Form.Range "30" %} checked {% end %}>Last 30
- days</label>
- <label><input type=radio name=range value=90 {% if eq .Form.Range "90" %} checked {% end %}>Last 90
- days</label>
- <label><input type=radio name=range value=180 {% if eq .Form.Range "180" %} checked {% end %}>Last 180
- days</label>
- <label><input type=radio name=range value=custom {% if eq .Form.Range "custom" %} checked
- {% end %}>Custom:</label>
+ <label><input type=radio name=range value=7 {% if eq .Form.Range "7" %} checked {% end %}>Last week</label>
+ <label><input type=radio name=range value=30 {% if eq .Form.Range "30" %} checked {% end %}>Last month</label>
+ <label><input type=radio name=range value=90 {% if eq .Form.Range "90" %} checked {% end %}>Last 3 months</label>
+ <label><input type=radio name=range value=180 {% if eq .Form.Range "180" %} checked {% end %}>Last 6 months</label>
+ <label><input type=radio name=range value=custom {% if eq .Form.Range "custom" %} checked {% end %}>Custom:</label>
<section class=custom>
<label>Begin <input type=date name=begin value="{% .Form.Begin %}"></label>
<label>End <input type=date name=end value="{% .Form.End %}"></label>