Reputation: 1190
I have a list of defects with different IDs. I need to go thru the list and gather fixed / verified defects to separate list.
Could you please advise if there is a way to make in one query (e.g. send a tuple in query) instead of each time send a new get request?
currently it looks like:
items = ("DE111", "DE123", "DE345")
defects = []
for item in items:
criteria = 'FormattedID = "%s"' % item
response = rally.get('Defect', fetch="Name,State", query=criteria)
for defect in response:
defects.append(defect)
Thank you in advance!
Upvotes: 0
Views: 1289
Reputation: 1784
Using a little Python 3 you can string together an 'or' conditional on the Formatted ID... If you don't have Python 3 I'm sure the same thing can be accomplished in 2. The important part is the ultimate query string which is : (((FormattedID = DE111) OR (FormattedID = DE112)) OR (FormattedID = DE123))
see an example on repl.it
from functools import reduce
items = ("DE111", "DE112")
def byFormattedId(value):
return "(FormattedID = \"%s\")" % value
def ors(statement, value):
return "(%s OR %s)" % (statement, value)
x = list(map(byFormattedId, items))
y = reduce(ors, x)
Upvotes: 1