Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date_from/date_to Filter #8

Closed
danielmanser opened this issue Feb 11, 2014 · 10 comments
Closed

date_from/date_to Filter #8

danielmanser opened this issue Feb 11, 2014 · 10 comments
Assignees
Labels

Comments

@danielmanser
Copy link

According to the docs, one can filter time entries from/to a specific date. I've tried with a few date formats, but it seems the filter does not work. What is the correct date format (according to the docs, a string)?

@maxtepkeev maxtepkeev self-assigned this Feb 11, 2014
@maxtepkeev
Copy link
Owner

time_entries = redmine.time_entry.filter(from_date='2013-12-03', to_date='2013-12-03')

Currently the from_date and to_date params accepts a string only in the format that is used by your Redmine server.

@danielmanser
Copy link
Author

Hm, that doesn't work as well.

@maxtepkeev
Copy link
Owner

What is your Redmine version ? Also what does it mean "doesn't work" ? Show me the code please.

@maxtepkeev
Copy link
Owner

Also please do this request directly in your browser:

http://your_redmine_server/time_entries.json?from=2013-12-02&to=2013-12-02

Of course change the dates to the ones you need and have a look at the returned result. Does it work this way ?

@danielmanser
Copy link
Author

My Redmine version is 2.1.0.stable. No matter what I set for date_from/date_to or from_date/to_date, I always get all entries (so they are not filtered). I don't get an error.

Trying your example from above directly in the browser, however, I can filter. So I get only the entries for 2013-12-02.

The code I'm using is:

time_entries = redmine.time_entry.filter(project_id='projectname', date_from='2013-01-01', date_to='2013-12-01')

This code gives me also entries for 2011, 2012 and 2014.

@maxtepkeev
Copy link
Owner

If the in-browser filtering works, it should also work via python-redmine. There is an error in the code you provided: the parameters are wrong: they should be from_date/to_date instead of date_from/date_to in your code. This is important.

@danielmanser
Copy link
Author

Thanks for your quick response. It doesn't work with from_date/to_date as well (which is what I've tried in the beginning, according to the docs). Also, I don't get an error. It seems like the two arguments aren't parsed at all. I'll do some debugging now, maybe I can provide more info.

@maxtepkeev
Copy link
Owner

Are you using the 0.5.0 version of python-redmine ?

I'm asking because this parameters only work starting from 0.4.0. Also please check redmine.resources.TimeEntry class, there should be a translate_params class method where a translation of this params occures. You can start debugging from here.

@danielmanser
Copy link
Author

Uh - yes. Installed via pip :-/

@maxtepkeev
Copy link
Owner

So the problem was in using the old version, right ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants