You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/12/13 22:38:51 UTC

incubator-ponymail git commit: Allow for null values, e, g, if list is empty min/max will be null

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master f40dd3c63 -> 4116d9bf4


Allow for null values, e,g, if list is empty min/max will be null

Follow up to 36e6d59

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/4116d9bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/4116d9bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/4116d9bf

Branch: refs/heads/master
Commit: 4116d9bf40a57a7319f2aaf084f88ac7a917d64c
Parents: f40dd3c
Author: Sebb <se...@apache.org>
Authored: Tue Dec 13 22:38:39 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Tue Dec 13 22:38:39 2016 +0000

----------------------------------------------------------------------
 site/api/stats.lua | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/4116d9bf/site/api/stats.lua
----------------------------------------------------------------------
diff --git a/site/api/stats.lua b/site/api/stats.lua
index 8e009f7..fa07ff7 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -478,9 +478,14 @@ function handle(r)
                 }
             }
         }
-        firstYear = tonumber(os.date("%Y", doc.aggregations.first.value/1000))
+        local first = doc.aggregations.first.value
+        if first == JSON.null then first = os.time() else first = first/1000 end
+        firstYear = tonumber(os.date("%Y", first))
         r:ivm_set(FIRSTYEAR_KEY, firstYear)
-        lastYear = tonumber(os.date("%Y", doc.aggregations.last.value/1000))
+
+        local last = doc.aggregations.last.value
+        if last == JSON.null then last = os.time() else last = last/1000 end
+        lastYear = tonumber(os.date("%Y", last))
         r:ivm_set(LASTYEAR_KEY, lastYear)
     end