fix(rubocop): Rails/RedundantActiveRecordAllMethod

This commit is contained in:
Colin Darie 2024-02-05 11:35:01 +01:00
parent 0da2843f26
commit 6ab3fa1cf4
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
7 changed files with 8 additions and 8 deletions

View file

@ -2,8 +2,8 @@ module Manager
class OutdatedProceduresController < Manager::ApplicationController
def index
@records_per_page = params[:records_per_page] || "10"
resources = Procedure.all
.where(procedure_expires_when_termine_enabled: false)
resources = Procedure.
where(procedure_expires_when_termine_enabled: false)
.order(created_at: :asc)
.page(params[:_page])
.per(@records_per_page)

View file

@ -9,7 +9,7 @@ class ProcedureRevisionPreloader
end
def self.load_one(revision)
ProcedureRevisionPreloader.new([revision]).all.first
ProcedureRevisionPreloader.new([revision]).all.first # rubocop:disable Rails/RedundantActiveRecordAllMethod
end
private

View file

@ -1,6 +1,6 @@
class CleanupAssignTosFromBetagouv < ActiveRecord::Migration[6.1]
def up
super_admin_emails = SuperAdmin.all.pluck(:email)
super_admin_emails = SuperAdmin.pluck(:email)
super_admin_emails.each do |email|
user = User.find_by(email: email)

View file

@ -1,6 +1,6 @@
class ReaddSuperAdminToTheirProcedureWithoutInstructeur < ActiveRecord::Migration[6.1]
def change
super_admin_emails = SuperAdmin.all.pluck(:email)
super_admin_emails = SuperAdmin.pluck(:email)
# we want to re-assign each super admin being an admin of a procedure
# to every procedure that lost all instructeur
# so we cache procedure without instructeur first

View file

@ -4,7 +4,7 @@ namespace :after_party do
puts "Running deploy task 'fix_dossier_transfer_with_uppercase'"
# in production, about 1000, no need to track progress
DossierTransfer.all.find_each do |dt|
DossierTransfer.find_each do |dt|
if /A-Z/.match?(dt.email)
dt.email = dt.email.downcase
dt.save

View file

@ -6,7 +6,7 @@ namespace :superadmin do
EOD
task list: :environment do
rake_puts "All SuperAdmins:"
SuperAdmin.all.pluck(:email).each do |a|
SuperAdmin.pluck(:email).each do |a|
puts a
end
end

View file

@ -123,7 +123,7 @@ describe Gestionnaires::GroupeGestionnairesController, type: :controller do
it do
subject
expect(GroupeGestionnaire.all.count).to eq(1)
expect(GroupeGestionnaire.count).to eq(1)
expect(response).to redirect_to(gestionnaire_groupe_gestionnaires_path)
end
end