Add and apply Layout/DotPosition rule
Since IRB has improved its support for multiline, the main argument towars using a trailing dot no longer affects most people. It still affects me, though, since I use Pry :), but I agree leading dots are more readable, so I'm enabling the rule anyway.
This commit is contained in:
@@ -21,6 +21,9 @@ Bundler/OrderedGems:
|
||||
Layout/AssignmentIndentation:
|
||||
Enabled: true
|
||||
|
||||
Layout/DotPosition:
|
||||
Enabled: true
|
||||
|
||||
Layout/EmptyLineAfterGuardClause:
|
||||
Enabled: true
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
|
||||
before_action :load_booth_assignment, only: [:create]
|
||||
|
||||
def index
|
||||
@officers = ::Poll::Officer.
|
||||
includes(:user).
|
||||
order("users.username").
|
||||
where(
|
||||
@officers = ::Poll::Officer
|
||||
.includes(:user)
|
||||
.order("users.username")
|
||||
.where(
|
||||
id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id)
|
||||
).page(params[:page]).per(50)
|
||||
end
|
||||
@@ -15,11 +15,11 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
|
||||
def by_officer
|
||||
@poll = ::Poll.includes(:booths).find(params[:poll_id])
|
||||
@officer = ::Poll::Officer.includes(:user).find(officer_assignment_params[:officer_id])
|
||||
@officer_assignments = ::Poll::OfficerAssignment.
|
||||
joins(:booth_assignment).
|
||||
includes(:recounts, booth_assignment: :booth).
|
||||
by_officer_and_poll(@officer.id, @poll.id).
|
||||
order(:date)
|
||||
@officer_assignments = ::Poll::OfficerAssignment
|
||||
.joins(:booth_assignment)
|
||||
.includes(:recounts, booth_assignment: :booth)
|
||||
.by_officer_and_poll(@officer.id, @poll.id)
|
||||
.order(:date)
|
||||
end
|
||||
|
||||
def search_officers
|
||||
|
||||
@@ -4,10 +4,10 @@ class Admin::Poll::RecountsController < Admin::Poll::BaseController
|
||||
def index
|
||||
@stats = Poll::Stats.new(@poll)
|
||||
|
||||
@booth_assignments = @poll.booth_assignments.
|
||||
includes(:booth, :recounts, :voters).
|
||||
order("poll_booths.name").
|
||||
page(params[:page]).per(50)
|
||||
@booth_assignments = @poll.booth_assignments
|
||||
.includes(:booth, :recounts, :voters)
|
||||
.order("poll_booths.name")
|
||||
.page(params[:page]).per(50)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -42,13 +42,13 @@ class Officing::BallotSheetsController < Officing::BaseController
|
||||
end
|
||||
|
||||
def load_officer_assignments
|
||||
@officer_assignments = ::Poll::OfficerAssignment.
|
||||
includes(booth_assignment: [:booth]).
|
||||
joins(:booth_assignment).
|
||||
final.
|
||||
where(id: current_user.poll_officer.officer_assignment_ids).
|
||||
where(poll_booth_assignments: { poll_id: @poll.id }).
|
||||
where(date: Date.current)
|
||||
@officer_assignments = ::Poll::OfficerAssignment
|
||||
.includes(booth_assignment: [:booth])
|
||||
.joins(:booth_assignment)
|
||||
.final
|
||||
.where(id: current_user.poll_officer.officer_assignment_ids)
|
||||
.where(poll_booth_assignments: { poll_id: @poll.id })
|
||||
.where(date: Date.current)
|
||||
end
|
||||
|
||||
def load_officer_assignment
|
||||
|
||||
@@ -21,12 +21,12 @@ class Officing::ResultsController < Officing::BaseController
|
||||
|
||||
def index
|
||||
@booth_assignment = ::Poll::BoothAssignment.includes(:booth).find(index_params[:booth_assignment_id])
|
||||
if current_user.poll_officer.officer_assignments.final.
|
||||
where(booth_assignment_id: @booth_assignment.id).exists?
|
||||
if current_user.poll_officer.officer_assignments.final
|
||||
.where(booth_assignment_id: @booth_assignment.id).exists?
|
||||
|
||||
@partial_results = ::Poll::PartialResult.includes(:question).
|
||||
where(booth_assignment_id: index_params[:booth_assignment_id]).
|
||||
where(date: index_params[:date])
|
||||
@partial_results = ::Poll::PartialResult.includes(:question)
|
||||
.where(booth_assignment_id: index_params[:booth_assignment_id])
|
||||
.where(date: index_params[:date])
|
||||
@recounts = ::Poll::Recount.where(booth_assignment_id: @booth_assignment.id, date: index_params[:date])
|
||||
end
|
||||
end
|
||||
@@ -89,18 +89,18 @@ class Officing::ResultsController < Officing::BaseController
|
||||
end
|
||||
|
||||
def load_officer_assignment
|
||||
@officer_assignment = current_user.poll_officer.
|
||||
officer_assignments.final.find_by(id: results_params[:officer_assignment_id])
|
||||
@officer_assignment = current_user.poll_officer
|
||||
.officer_assignments.final.find_by(id: results_params[:officer_assignment_id])
|
||||
end
|
||||
|
||||
def load_officer_assignments
|
||||
@officer_assignments = ::Poll::OfficerAssignment.
|
||||
includes(booth_assignment: [:booth]).
|
||||
joins(:booth_assignment).
|
||||
final.
|
||||
where(id: current_user.poll_officer.officer_assignment_ids).
|
||||
where(poll_booth_assignments: { poll_id: @poll.id }).
|
||||
where(date: Date.current)
|
||||
@officer_assignments = ::Poll::OfficerAssignment
|
||||
.includes(booth_assignment: [:booth])
|
||||
.joins(:booth_assignment)
|
||||
.final
|
||||
.where(id: current_user.poll_officer.officer_assignment_ids)
|
||||
.where(poll_booth_assignments: { poll_id: @poll.id })
|
||||
.where(date: Date.current)
|
||||
end
|
||||
|
||||
def load_partial_results
|
||||
|
||||
@@ -22,8 +22,8 @@ module AdminBudgetInvestmentsHelper
|
||||
end
|
||||
|
||||
def valuator_select_options(budget)
|
||||
budget.valuators.order("description ASC").order("users.email ASC").includes(:user).
|
||||
map { |v| [v.description_or_email, "valuator_#{v.id}"] }
|
||||
budget.valuators.order("description ASC").order("users.email ASC").includes(:user)
|
||||
.map { |v| [v.description_or_email, "valuator_#{v.id}"] }
|
||||
end
|
||||
|
||||
def valuator_group_select_options
|
||||
|
||||
@@ -109,8 +109,8 @@ class Budget
|
||||
end
|
||||
|
||||
def self.by_valuator_group(valuator_group_id)
|
||||
joins(:valuator_group_assignments).
|
||||
where(budget_valuator_group_assignments: { valuator_group_id: valuator_group_id })
|
||||
joins(:valuator_group_assignments)
|
||||
.where(budget_valuator_group_assignments: { valuator_group_id: valuator_group_id })
|
||||
end
|
||||
|
||||
before_validation :set_responsible_name
|
||||
@@ -198,8 +198,8 @@ class Budget
|
||||
def self.search_by_title_or_id(title_or_id)
|
||||
with_joins = with_translations(Globalize.fallbacks(I18n.locale))
|
||||
|
||||
with_joins.where(id: title_or_id).
|
||||
or(with_joins.where("budget_investment_translations.title ILIKE ?", "%#{title_or_id}%"))
|
||||
with_joins.where(id: title_or_id)
|
||||
.or(with_joins.where("budget_investment_translations.title ILIKE ?", "%#{title_or_id}%"))
|
||||
end
|
||||
|
||||
def searchable_values
|
||||
|
||||
@@ -16,17 +16,17 @@ class Poll
|
||||
end
|
||||
|
||||
def voting_days_assigned_polls
|
||||
officer_assignments.voting_days.includes(booth_assignment: :poll).
|
||||
map(&:booth_assignment).
|
||||
map(&:poll).uniq.compact.
|
||||
sort { |x, y| y.ends_at <=> x.ends_at }
|
||||
officer_assignments.voting_days.includes(booth_assignment: :poll)
|
||||
.map(&:booth_assignment)
|
||||
.map(&:poll).uniq.compact
|
||||
.sort { |x, y| y.ends_at <=> x.ends_at }
|
||||
end
|
||||
|
||||
def final_days_assigned_polls
|
||||
officer_assignments.final.includes(booth_assignment: :poll).
|
||||
map(&:booth_assignment).
|
||||
map(&:poll).uniq.compact.
|
||||
sort { |x, y| y.ends_at <=> x.ends_at }
|
||||
officer_assignments.final.includes(booth_assignment: :poll)
|
||||
.map(&:booth_assignment)
|
||||
.map(&:poll).uniq.compact
|
||||
.sort { |x, y| y.ends_at <=> x.ends_at }
|
||||
end
|
||||
|
||||
def todays_booths
|
||||
|
||||
@@ -7,11 +7,11 @@ class TagCloud
|
||||
end
|
||||
|
||||
def tags
|
||||
resource_model_scoped.
|
||||
last_week.send(counts).
|
||||
where("lower(name) NOT IN (?)", category_names + geozone_names + default_blacklist).
|
||||
order("#{table_name}_count": :desc, name: :asc).
|
||||
limit(10)
|
||||
resource_model_scoped
|
||||
.last_week.send(counts)
|
||||
.where("lower(name) NOT IN (?)", category_names + geozone_names + default_blacklist)
|
||||
.order("#{table_name}_count": :desc, name: :asc)
|
||||
.limit(10)
|
||||
end
|
||||
|
||||
def counts
|
||||
|
||||
@@ -2,8 +2,8 @@ class Verification::Management::ManagedUser
|
||||
include ActiveModel::Model
|
||||
|
||||
def self.find(document_type, document_number)
|
||||
User.where.not(document_number: nil).
|
||||
find_or_initialize_by(document_type: document_type,
|
||||
User.where.not(document_number: nil)
|
||||
.find_or_initialize_by(document_type: document_type,
|
||||
document_number: document_number)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% annotation.comments.roots.sort_by_most_voted.
|
||||
limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %>
|
||||
<% annotation.comments.roots.sort_by_most_voted
|
||||
.limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %>
|
||||
<div class="comment">
|
||||
<div class="comment-text">
|
||||
<p><%= truncate comment.body, length: 250 %></p>
|
||||
|
||||
@@ -220,8 +220,8 @@ describe RemoteTranslations::Caller, :remote_translations do
|
||||
locale = remote_translation.locale
|
||||
fake_response = ["translated title", "translated description", "translated summary", nil]
|
||||
|
||||
expect_any_instance_of(client).to receive(:call).with(field_values_sanitized, locale).
|
||||
and_return(fake_response)
|
||||
expect_any_instance_of(client).to receive(:call).with(field_values_sanitized, locale)
|
||||
.and_return(fake_response)
|
||||
|
||||
caller.call
|
||||
end
|
||||
|
||||
@@ -10,8 +10,8 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
|
||||
before do
|
||||
Setting["feature.remote_translations"] = true
|
||||
available_locales_response = %w[de en es fr pt zh-Hans]
|
||||
expect(RemoteTranslations::Microsoft::AvailableLocales).to receive(:available_locales).at_most(4).times.
|
||||
and_return(available_locales_response)
|
||||
expect(RemoteTranslations::Microsoft::AvailableLocales).to receive(:available_locales).at_most(4).times
|
||||
.and_return(available_locales_response)
|
||||
allow(Rails.application.secrets).to receive(:microsoft_api_key).and_return("123")
|
||||
end
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ module CommonActions
|
||||
end
|
||||
|
||||
def validate_officer
|
||||
allow_any_instance_of(Officing::BaseController).
|
||||
to receive(:verify_officer_assignment).and_return(true)
|
||||
allow_any_instance_of(Officing::BaseController)
|
||||
.to receive(:verify_officer_assignment).and_return(true)
|
||||
end
|
||||
|
||||
def fill_in_proposal
|
||||
@@ -69,8 +69,8 @@ module CommonActions
|
||||
def set_officing_booth(booth = nil)
|
||||
booth = create(:poll_booth) if booth.blank?
|
||||
|
||||
allow_any_instance_of(Officing::BaseController).
|
||||
to receive(:current_booth).and_return(booth)
|
||||
allow_any_instance_of(Officing::BaseController)
|
||||
.to receive(:current_booth).and_return(booth)
|
||||
end
|
||||
|
||||
def click_sdg_goal(code)
|
||||
|
||||
@@ -32,8 +32,8 @@ describe "DocumentVerifications" do
|
||||
describe "Verifying througth Census" do
|
||||
context "Census API" do
|
||||
scenario "Verifying a user which does not exist and is not in the census shows an error" do
|
||||
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?).
|
||||
and_return(false)
|
||||
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?)
|
||||
.and_return(false)
|
||||
|
||||
login_as_manager
|
||||
visit management_document_verifications_path
|
||||
@@ -55,8 +55,8 @@ describe "DocumentVerifications" do
|
||||
|
||||
context "Remote Census API", :remote_census do
|
||||
scenario "Verifying a user which does not exist and is not in the census shows an error" do
|
||||
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?).
|
||||
and_return(false)
|
||||
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?)
|
||||
.and_return(false)
|
||||
|
||||
login_as_manager
|
||||
visit management_document_verifications_path
|
||||
|
||||
Reference in New Issue
Block a user