Skip to content

Commit

Permalink
More linting
Browse files Browse the repository at this point in the history
  • Loading branch information
alecslupu committed Nov 21, 2023
1 parent 03e2b1c commit 6c59449
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 1 addition & 8 deletions decidim-proposals/app/models/decidim/proposals/proposal.rb
Expand Up @@ -79,7 +79,7 @@ def assign_state(token)
scope :not_status, ->(status) { joins(:proposal_state).where.not(decidim_proposals_proposal_states: { token: status }) }
scope :only_status, ->(status) { joins(:proposal_state).where(decidim_proposals_proposal_states: { token: status }) }

scope :gamified, -> { state_published.only_status(:accepted) }
scope :gamified, -> { state_published.only_status(:accepted).where(decidim_proposals_proposal_states: { gamified: true }) }

scope :accepted, -> { state_published.only_status(:accepted) }
scope :rejected, -> { state_published.only_status(:rejected) }
Expand Down Expand Up @@ -224,10 +224,6 @@ def customized_proposal_state
# Returns Boolean.
def state
raise "Method deprecated use customized_proposal_#{__method__}"
return amendment.state if emendation?
return nil unless published_state? || withdrawn?

proposal_state&.token
end

# This is only used to define the setter, as the getter will be overriden below.
Expand All @@ -244,9 +240,6 @@ def customized_proposal_internal_state
# Returns Boolean.
def internal_state
raise "Method deprecated use customized_proposal_#{__method__}"
return amendment.state if emendation?

proposal_state&.token
end

# Public: Checks if the organization has published the state for the proposal.
Expand Down
4 changes: 3 additions & 1 deletion decidim-proposals/lib/decidim/proposals/test/factories.rb
Expand Up @@ -255,8 +255,9 @@ def generate_state_title(token)
token { :not_answered }
title { generate_state_title(:not_answered) }
description { Decidim::Faker::Localized.localized { Faker::Lorem.sentences(number: 3).join("\n") } }
component { create(:proposal_component) }
component { build(:proposal_component) }
default { false }
gamified { false }
system { true }
css_class { "" }

Expand All @@ -272,6 +273,7 @@ def generate_state_title(token)
title { generate_state_title(:accepted) }
token { :accepted }
system { true }
gamified { true }
notifiable { true }
answerable { true }
end
Expand Down

0 comments on commit 6c59449

Please sign in to comment.