apache / incubator-ponymail-foal

Apache Pony Mail Foal (Next Generation Suite)
https://ponymail.apache.org
Apache License 2.0
28 stars 14 forks source link

Query param e is ignored on stats.lua #234

Closed nfrankel closed 2 years ago

nfrankel commented 2 years ago

I tried to use the existing API deployed on https://ponymail.apache.org/.

curl https://lists.apache.org/api/stats.lua\?list\=dev\&domain\=apisix

The result is:

{
    "firstYear": 1970,
    "lastYear": 1970,
    "firstMonth": 1,
    "lastMonth": 1,
    "active_months": {},
    "hits": 0,
    "numparts": 0,
    "no_threads": 0,
    "emails": [],
    "participants": {},
    "searchlist": "<dev.apisix>",
    "domain": "apisix",
    "name": "dev",
    "list": "dev@apisix",
    "searchParams": {
        "list": "dev",
        "domain": "apisix",
        "e": "2022-02"
    },
    "unixtime": 1647593751,
    "thread_struct": []
}

Note that lastMonthand lastYear are respectively 1 and `1970.

Now, I explicitely set the end period:

curl https://lists.apache.org/api/stats.lua\?list\=dev\&domain\=apisix\&e\=2022-02

The boundaries haven't changed:

{
    "firstYear": 1970,
    "lastYear": 1970,
    "firstMonth": 1,
    "lastMonth": 1,
    "active_months": {},
    "hits": 0,
    "numparts": 0,
    "no_threads": 0,
    "emails": [],
    "participants": {},
    "searchlist": "<dev.apisix>",
    "domain": "apisix",
    "name": "dev",
    "list": "dev@apisix",
    "searchParams": {
        "list": "dev",
        "domain": "apisix",
        "e": "2022-02"
    },
    "unixtime": 1647593996,
    "thread_struct": []
}

Either there's an issue, or I'm misunderstanding how it works.

Humbedooh commented 2 years ago

two things:

Humbedooh commented 2 years ago

I'll also note that firstYear and lastYear won't change because of this, they'll always show the absolute values

nfrankel commented 2 years ago

Thanks a lot for your very fast feedback! Appreciate this. Perhaps the documentation could mention this?

Feel free to close the issue as it's obviously not relevant.

Humbedooh commented 2 years ago

That's a good suggestion, thanks. Our API docs are in need of a revamp anyway :)