Skip to content

Commit

Permalink
Merge pull request #17409 from Homebrew/contributions-fix-review-counts
Browse files Browse the repository at this point in the history
Fix constructing search query strings with date ranges
  • Loading branch information
issyl0 authored Jun 2, 2024
2 parents 11f042e + a23dad7 commit 02c59d1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Library/Homebrew/utils/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,18 @@ def self.private_repo?(full_name)
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

Expand Down

0 comments on commit 02c59d1

Please sign in to comment.