Coder Social home page Coder Social logo

Comments (10)

maxtepkeev avatar maxtepkeev commented on August 31, 2024

This information is from official Redmine REST API docs. You can see the available combinations at the link I provided, but I believe that this kind of query will only work with timestamp fields, so I'm 99% sure that this won't work for your exact case. Also I've just tried to find all issues from a project with more than one author via the usual Redmine GUI and I wasn't able to do that, because when you apply the author filter for one person, you can't add second author filter for another person, so it just isn't possible at all. You have to get all issues from a project and then filter them in cycle.

Speaking about this filter operations - this is not a magic done by Python-Redmine, this filter operations are provided by the Redmine itself and Python-Redmine just sends this operations to Redmine and receives the response.

from python-redmine.

necrolyte2 avatar necrolyte2 commented on August 31, 2024

I guess author_id is a bad example.
This really isn't python-redmine's fault as much as it is Redmine's documentation, but there doesn't seem to be any place that lists the operators that you can use for the different field types.

Say if you have a Custom Field that is a MultipleList type. From Redmine's interface you can do an in operation, but I'm not sure how to do it through the api

from python-redmine.

maxtepkeev avatar maxtepkeev commented on August 31, 2024

Yeah, I understand the problem.

I also wasn't able to find any docs that lists all the available operators, so I looked at Redmine's source code and I believe that it should be what we're looking for, though I didn't test it and I'm not sure if it will work.

Also I don't have an answer right now to your question about multiple custom fields.

I believe the only thing we can do is to look through the entire Redmine's source code and to find all this operators, then test them and see if they work or not. This is a big amount of work, so I can't do that right now, but I will do a little bit later.

This issue will remain open until we won't find answers to all this questions.

from python-redmine.

jesselang avatar jesselang commented on August 31, 2024

I figured I'd chime in quickly and mention that I had problems filtering issues against a datetime. Date worked fine, but datetime would not. I found that the ability to filter against a datetime was added in Redmine 2.5, and I was using 2.4.

http://www.redmine.org/issues/8842

Once I upgraded, I could use a filter like:
redmine.issue.filter(updated_on='>=%s' % last_checked.strftime('%Y-%m-%dT%H:%M:%SZ'))

Cheers!

from python-redmine.

indera avatar indera commented on August 31, 2024

Redmine 2.6 references the "fixed_version" in two places which might be worth investigating

== versions_controller.rb

47         @issues_by_version = {}
 48         if @selected_tracker_ids.any? && @versions.any?
 49           issues = Issue.visible.
 50             includes(:project, :tracker).
 51             preload(:status, :priority, :fixed_version).
 52             where(:tracker_id => @selected_tracker_ids, :project_id => project_ids, :fixed_version_id => @versions.map(&:id)).
 53             order("#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id")
 54           @issues_by_version = issues.group_by(&:fixed_version)

== issue_query.rb

197     if versions.any?
198       add_available_filter "fixed_version_id",
199         :type => :list_optional,
200         :values => versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] }
201     end
...
388   # Returns the versions
389   # Valid options are :conditions
390   def versions(options={})
391     Version.visible.
392       where(project_statement).
393       where(options[:conditions]).
394       includes(:project).
395       all

from python-redmine.

indera avatar indera commented on August 31, 2024

I can confirm that the API supports filtering the issues by the
"fixed_version_id=your_sprint_id"

@see https://github.com/ctsit/redman/blob/master/fabfile.py#L350

from python-redmine.

benvdh avatar benvdh commented on August 31, 2024

I did some testing with the fixed_version parameter for selecting all issues related to a particular version within a project Based on a StackOverflow answer[1]. It seems to work properly only when you also add the project_id in the url, something the python-redmine issue.filter() function currently does not do. I also could not find this case documentation in the redmine REST API documentation. However, it does work luckily. The author of the answer uses the following:

GET /projects/[project id]/issues.json?set_filter=1&fixed_version_id=[fixed version id]

[1]http://stackoverflow.com/questions/19906773/using-redmine-rest-api-to-access-issues-with-criteria

Maybe nice to add this in a next version of python-redmine?

from python-redmine.

benvdh avatar benvdh commented on August 31, 2024

Ok, just found the documentation @necrolyte2 was looking for:

http://www.freelancingdigest.com/articles/redmine-query-reference/

@maxtepkeev: would it be possible to somehow integrate the above in python-redmine?

from python-redmine.

maxtepkeev avatar maxtepkeev commented on August 31, 2024

@benvdh

Regarding the #57 (comment), thanks for this information, the problem is that if we use the /projects/[project id]/issues.json URL instead of just issues.json in issue.filter() we make the project_id argument required which is not what we want in most cases, I have to think how to implement this properly.

Regarding the #57 (comment) - cool, thanks for this, I definitely will add this into new documentation which will be available together with python-redmine v2.0 that should be ready approximately by the end of October.

from python-redmine.

benvdh avatar benvdh commented on August 31, 2024

Not sure whether this the most elegant solution, but might a filter_by_project() method be an option ?

Personally, I implemented by creating a custom_resource class, and changed the url there...

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.