Coder Social home page Coder Social logo

Comments (4)

maxtepkeev avatar maxtepkeev commented on July 27, 2024

Hi Augustin!

I can't reproduce this problem here. It works for me as it should, can you tell me a little bit more about your environment i.e. Redmine and Python version.

from python-redmine.

Augustin82 avatar Augustin82 commented on July 27, 2024

Hi Max,

thank you for answering.

I am running Python 2.7.6 and we run ChiliProject (3.2.1.221a2e73c), not a vanilla Redmine. Apologies for not stating this right away, I should have. I didn't think it would be a factor, since the REST API works like it should, returning the right number of items.

Do you have any idea what could cause this discrepancy?

Cheers.

from python-redmine.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

I think I found the problem and it's related with this ChiliProject fork of Redmine. Below is the detailed explanation of the problem.

ChiliProject's REST API for time entries doesn't support limit and offset for some reason, you can test that by yourself, e.g. https://YOUR_SERVER/time_entries.json?limit=1 won't work. On the other hand if you try this on native Redmine it will work.

Python-Redmine tries it's best to mimic limit/offset if it's not supported by the Redmine resource itself. So it's also tries to mimic it for the ChiliProject's time entries. But why you get only 25 resources ? Read below.

In ChiliProject you can use per_page and page GET parameters to control what time entries you want to get, by default it's using per_page=25 & page=1, this is why you always get 25 entries.

So what can you do ? You can use python-redmine with parameters per_page and page to get time entries and then make additional request for the next page and check if there are more entries and then make another request if there more etc., e.g:

    time_entries = redmine.time_entry.filter(from_date="2014-07-22", per_page=100, page=2)

per_page only supports values of 25, 50 and 100. So you can't do per_page=1 or 10, if you need this you can add limit parameter and python-redmine will limit results manually for you, e.g.:

    time_entries = redmine.time_entry.filter(from_date="2014-07-22", per_page=100, page=2, limit=10)

Also I highly recommend you to fill a feature request for the ChiliProject to add support for limit/offset on it's own level to be more compatible with Redmine and also to make requests to API more efficient.

Hope that helps. If you still have questions feel free to ask, if not, feel free to close this issue.

from python-redmine.

Augustin82 avatar Augustin82 commented on July 27, 2024

Wow, I'm really impressed! You've juste saved me more hours of frustration, by debugging something you are not responsible for.
Thank you very much for your great explanation and for the solution. I'm going to post another issue regarding time entries but this one is solved.

from python-redmine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.