Fix constructing search query strings with date ranges
- Both `from` and `to` are now separate keyword arguments in a bunch of places, not part of `args`. - When we switched this around, we didn't realize this method needed updating to correctly construct the time range query. - This led to further inaccurate counts in `brew contributions` for reviews, since `from` and `to` are not valid search qualifiers for the GitHub PR search APIs.
This commit is contained in:
parent
11f042e387
commit
a23dad737f
@ -151,17 +151,18 @@ module GitHub
|
||||
def self.search_query_string(*main_params, **qualifiers)
|
||||
params = main_params
|
||||
|
||||
if (args = qualifiers.fetch(:args, nil))
|
||||
params << if args.from && args.to
|
||||
"created:#{args.from}..#{args.to}"
|
||||
elsif args.from
|
||||
"created:>=#{args.from}"
|
||||
elsif args.to
|
||||
"created:<=#{args.to}"
|
||||
end
|
||||
from = qualifiers.fetch(:from, nil)
|
||||
to = qualifiers.fetch(:to, nil)
|
||||
|
||||
params << if from && to
|
||||
"created:#{from}..#{to}"
|
||||
elsif from
|
||||
"created:>=#{from}"
|
||||
elsif to
|
||||
"created:<=#{to}"
|
||||
end
|
||||
|
||||
params += qualifiers.except(:args).flat_map do |key, value|
|
||||
params += qualifiers.except(:args, :from, :to).flat_map do |key, value|
|
||||
Array(value).map { |v| "#{key.to_s.tr("_", "-")}:#{v}" }
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user