Add and apply rules for multi-line arrays

We were already applying these rules in most cases.

Note we aren't enabling the `MultilineArrayLineBreaks` rule because
we've got places with many elements whire it isn't clear whether
having one element per line would make the code more readable.
This commit is contained in:
Javi Martín
2023-07-01 16:05:32 +02:00
parent 1cb6268d4e
commit 97aca0cf95
10 changed files with 43 additions and 29 deletions

View File

@@ -8,13 +8,16 @@ class Shared::AdvancedSearchComponent < ApplicationComponent
end
def date_range_options
options_for_select([
[t("shared.advanced_search.date_1"), 1],
[t("shared.advanced_search.date_2"), 2],
[t("shared.advanced_search.date_3"), 3],
[t("shared.advanced_search.date_4"), 4],
[t("shared.advanced_search.date_5"), "custom"]],
selected_date_range)
options_for_select(
[
[t("shared.advanced_search.date_1"), 1],
[t("shared.advanced_search.date_2"), 2],
[t("shared.advanced_search.date_3"), 3],
[t("shared.advanced_search.date_4"), 4],
[t("shared.advanced_search.date_5"), "custom"]
],
selected_date_range
)
end
def selected_date_range

View File

@@ -60,13 +60,14 @@ class Admin::BudgetsController < Admin::BaseController
def allowed_params
descriptions = Budget::Phase::PHASE_KINDS.map { |p| "description_#{p}" }.map(&:to_sym)
valid_attributes = [:phase,
:currency_symbol,
:voting_style,
:hide_money,
administrator_ids: [],
valuator_ids: [],
image_attributes: image_attributes
valid_attributes = [
:phase,
:currency_symbol,
:voting_style,
:hide_money,
administrator_ids: [],
valuator_ids: [],
image_attributes: image_attributes
] + descriptions
[*valid_attributes, *report_attributes, translation_params(Budget)]

View File

@@ -77,12 +77,12 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
investment_headings = Budget::Heading.where(id: investments.pluck(:heading_id)).sort_by(&:name)
all_headings_filter = [
{
name: t("valuation.budget_investments.index.headings_filter_all"),
id: nil,
count: investments.size
}
]
{
name: t("valuation.budget_investments.index.headings_filter_all"),
id: nil,
count: investments.size
}
]
investment_headings.reduce(all_headings_filter) do |filters, heading|
filters << {

View File

@@ -1,7 +1,7 @@
class Budget
class Phase < ApplicationRecord
PHASE_KINDS = %w[informing accepting reviewing selecting valuating publishing_prices balloting
reviewing_ballots finished].freeze
reviewing_ballots finished].freeze
PUBLISHED_PRICES_PHASES = %w[publishing_prices balloting reviewing_ballots finished].freeze
DESCRIPTION_MAX_LENGTH = 2000

View File

@@ -6,8 +6,8 @@ class Comment < ApplicationRecord
include Searchable
COMMENTABLE_TYPES = %w[Debate Proposal Budget::Investment Poll Topic
Legislation::Question Legislation::Annotation
Legislation::Proposal].freeze
Legislation::Question Legislation::Annotation
Legislation::Proposal].freeze
acts_as_paranoid column: :hidden_at
include ActsAsParanoidAliases

View File

@@ -163,8 +163,7 @@ module Statisticable
[75, 79],
[80, 84],
[85, 89],
[90, 300]
]
[90, 300]]
end
def participants_between_ages(from, to)