get_trend() does not calculate the trend properly for the Authors class
canasdiaz opened this issue · 3 comments
canasdiaz commented
I'm not sure I understood the get_trend() method. I tried to get the trend in number of authors of the last 12 months but it just get the value of the author on starting date (on that day) and the number of authors on the end date (on that day) and do the math.
from datetime import date, timedelta, timezone
from dateutil import parser
from manuscripts.metrics import git
url = "https://mydashboard.com/data"
start_date = "2017-04-02"
end_date = "2018-04-02"
sd = parser.parse(start_date).replace(tzinfo=timezone.utc)
ed = parser.parse(end_date).replace(tzinfo=timezone.utc)
g = git.Authors(url, "git", start=sd, end=ed, esfilters={}, interval=None, offset=None)
print(g.get_trend())
Is the code above right? Did i do something wrong?
How to reproduce:
- get code with version 53604fe
- install the requirements.txt in a fresh new virtual environment
- execute the script above with a git index with some data, at least from 2017-04-01
aswanipranjal commented
Hey, @sanacl, url
is the address of your elasticsearch instance, right?
Also, can you post the output?
acs commented
@sanacl checking it ... the method returns:
return (last, trend_percentage)
so you need to get the second value of the tuple returned by get_trend
, and it is the trend in %.
acs commented
Fixed with @sanacl in a f2f meeting. Closing this ticket.