Skip to content

Commit

Permalink
lint: Fix rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Dec 22, 2023
1 parent 6a6db38 commit db9cccb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This migration comes from decidim_custom_proposal_states (originally 20231102173159)

class CreateDecidimProposalsProposalState < ActiveRecord::Migration[6.0]
Expand All @@ -19,4 +20,4 @@ def change
t.string :css_class
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This migration comes from decidim_custom_proposal_states (originally 20231102173214)

class AddStateIdToDecidimProposalsProposals < ActiveRecord::Migration[6.0]
Expand All @@ -12,4 +13,4 @@ def down
remove_foreign_key :decidim_proposals_proposals, column: :decidim_proposals_proposal_state_id
remove_column :decidim_proposals_proposals, :decidim_proposals_proposal_state_id
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This migration comes from decidim_custom_proposal_states (originally 20231102234909)

class CreateDefaultProposalStates < ActiveRecord::Migration[6.0]
Expand All @@ -15,17 +16,19 @@ class Proposal < ApplicationRecord
def up
return unless Decidim.version.to_s.include?("0.26")

# rubocop:disable Lint/UselessAssignment
states = {
"0" => :not_answered,
"0" => :not_answered,
"10" => :evaluating,
"20" => :accepted,
"-10" => :rejected,
"-20" => :withdrawn
}

# rubocop:enable Lint/UselessAssignment
# rubocop:disable Rails/SkipsModelValidations
Proposal.where(state: "").update_all(state: "not_answered")
Proposal.where(state: nil).update_all(state: "not_answered")

# rubocop:enable Rails/SkipsModelValidations
Decidim::Component.where(manifest_name: "proposals").find_each do |component|
admin_user = component.organization.admins.first
default_states = Decidim::CustomProposalStates.create_default_states!(component, admin_user).with_indifferent_access
Expand All @@ -38,4 +41,4 @@ def up
end

def down; end
end
end

0 comments on commit db9cccb

Please sign in to comment.