Skip to content

Upgrade/rails 8.1 rubocop#1053

Open
pdl wants to merge 8 commits intochimera/upgrade-rails-devopsfrom
upgrade/rails-8.1-rubocop
Open

Upgrade/rails 8.1 rubocop#1053
pdl wants to merge 8 commits intochimera/upgrade-rails-devopsfrom
upgrade/rails-8.1-rubocop

Conversation

@pdl
Copy link
Copy Markdown
Contributor

@pdl pdl commented Apr 20, 2026

Fixing the rubocop config and running it for rails 8.1.

@pdl
Copy link
Copy Markdown
Contributor Author

pdl commented Apr 21, 2026

@leonardow-unep-wcmc FYI only, keeping this a separate PR for now.

select('taxon_concept_id, sum(quantity) as count_all').
group(:taxon_concept_id).
order('count_all desc').
order(count_all: :desc).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not work as symbol because count_all is not a normal column.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with:

Trade::Shipment.
  select('taxon_concept_id, sum(quantity) as count_all').
  where(taxon_concept_id: ..200).
  group(:taxon_concept_id).
  order(count_all: :desc) # or 'count_all desc'

And they return the same order.

Comment thread app/models/api_request.rb
where.not(user_id: nil)
self.from("(#{subquery.to_sql}) AS api_requests").
order('cnt DESC').limit(50)
order(cnt: :desc).limit(50)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue like count_all

def self.years_array
self.select('EXTRACT(year from start_date)::VARCHAR years').
group(:years).order('years DESC').map(&:years)
group(:years).order(years: :desc).map(&:years)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

where([ "properties->>'taxonomy_name' = ?", @taxonomy ]).
group("properties->>'id', properties->>'full_name'").
order('number_of_visits DESC')
order(number_of_visits: :desc)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants