You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, you are right. Unfortunately we can do nothing about it because this is how the custom fields filtering works on the Redmine side and Python Redmine is just the interface for the Redmine API.
So one thing that you can do is to fill a bug report on the Redmine forum and probably they will fix it some day. Until they fix this behaviour you can check the custom field flag to make it work for all projects and not just the specific one(s), this way issue filtering will work as you expect.
Probably another thing you can do is something like
forprojectinredmine.project.all():
issues=redmine.issue.filter(project_id=project.id, subproject_id='!*', cf_1="random")
issue_count=len(issues)
ifissue_count>0andissues[0].custom_fields.get(1) isnotNone:
print'Project {0} has {1} issues with custom field with an id of 1'.format(project.name, issue_count)
else:
print'Project {0} has no issues with custom field with an id of 1'.format(project.name)
Of course this is a dirty workaround around the Redmine API behaviour but it should work. Also keep in mind that I haven't check this code but again, it should work.
Sorry there was a logical error in my code. I updated my previous comment with the correct version. Though it's not the complete solution to your problem, e.g. it doesn't check for a specific value for a custom field, but you should get the general idea about how you can accomplish what you need.
Hi,
if I filter issues by a custom field I am getting all issues returned if the project dosen't use this custom field
example:
if I got two projects, p1 and p2 with each 10 issues and only p2 is using my custom field cf which is always empty (with id 1)
the result is:
I would expect that both results are 0 or an exception for p1
The text was updated successfully, but these errors were encountered: