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 2017/01/08 23:38:03 UTC
incubator-ponymail git commit: Simplify - use epoch rather than date
Repository: incubator-ponymail
Updated Branches:
refs/heads/master 079af347c -> 8cd1c3c30
Simplify - use epoch rather than date
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/8cd1c3c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/8cd1c3c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/8cd1c3c3
Branch: refs/heads/master
Commit: 8cd1c3c3043a3d6a4201bc6124187124c2f45dd5
Parents: 079af34
Author: Sebb <se...@apache.org>
Authored: Sun Jan 8 23:37:52 2017 +0000
Committer: Sebb <se...@apache.org>
Committed: Sun Jan 8 23:37:52 2017 +0000
----------------------------------------------------------------------
site/api/stats.lua | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/8cd1c3c3/site/api/stats.lua
----------------------------------------------------------------------
diff --git a/site/api/stats.lua b/site/api/stats.lua
index 4e05d18..decf712 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -410,8 +410,8 @@ function handle(r)
must = {
{
range = {
- date = {
- gt = "1970/01/01 00:00:00",
+ epoch = {
+ gt = 0
}
}
},
@@ -422,24 +422,24 @@ function handle(r)
aggs = {
first = {
min = {
- field = "date"
+ field = "epoch"
}
},
last = {
max = {
- field = "date"
+ field = "epoch"
}
}
}
}
datespan = {}
local first = doc.aggregations.first.value
- if first == JSON.null then first = os.time() else first = first/1000 end
+ if first == JSON.null then first = os.time() else first = first end
datespan.firstYear = tonumber(os.date("%Y", first))
datespan.firstMonth = tonumber(os.date("%m", first))
local last = doc.aggregations.last.value
- if last == JSON.null then last = os.time() else last = last/1000 end
+ if last == JSON.null then last = os.time() else last = last end
datespan.lastYear = tonumber(os.date("%Y", last))
datespan.lastMonth = tonumber(os.date("%m", last))