Skip to content

Commit

Permalink
Comply to rubocop & haml-lin
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian-Hirt committed Dec 28, 2023
1 parent c95b1c0 commit 80c8bdf
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/grids/admin/uploads.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Uploads < ApplicationGrid
scope.joins(file_attachment: :blob).where(blob: { content_type: value })
end

filter :uploaded_by, :enum, select: User.where(id: Upload.all.select(:user_id)).map { |user| [user.username, user.id] }.sort << ['-', 0],
filter :uploaded_by, :enum, select: User.where(id: Upload.select(:user_id)).map { |user| [user.username, user.id] }.sort << ['-', 0],
include_blank: _('Form|Select|Show all') do |value, scope, _grid|
if value == '0'
scope.where(user_id: nil)
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/tournament_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def format_match_score(match, relevant_team)
show_score = match.away_score != 0 || match.home_score != 0

team = match.send(relevant_team)
score = match.send("#{relevant_team}_score").to_s
score = match.send(:"#{relevant_team}_score").to_s

if match.draw?
tag.span(class: 'text-warning') do
Expand All @@ -26,7 +26,7 @@ def format_match_score_large(match, relevant_team)
show_score = match.away_score != 0 || match.home_score != 0

team = match.send(relevant_team)
score = match.send("#{relevant_team}_score").to_s
score = match.send(:"#{relevant_team}_score").to_s

# rubocop:disable Lint/DuplicateBranch
if match.errors.any?
Expand Down
2 changes: 1 addition & 1 deletion app/models/application_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.validates_boolean(attribute, **)

def self.translate_enums
defined_enums.each_key do |key|
define_method "humanized_#{key}" do
define_method :"humanized_#{key}" do
_("#{self.class.name}|#{key}|#{send(key)}")
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/encryptable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Encryptable

class_methods do
def encryptable_attribute(name, attributes = nil)
define_method "encrypted_#{name}" do
define_method :"encrypted_#{name}" do
if attributes.nil?
data = send(name)
elsif attributes.is_a?(Array)
Expand Down
2 changes: 1 addition & 1 deletion app/models/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def remove_address
fail 'Wrong status' unless completed?

SHIPPING_ADDRESS_FIELDS.each do |field|
public_send("#{field}=", nil)
public_send(:"#{field}=", nil)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/operations/admin/seat_map/load_seats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def data
seats: []
}

seat_map.seats.includes(:seat_category, ticket: :assignee).each do |seat|
seat_map.seats.includes(:seat_category, ticket: :assignee).find_each do |seat|
seat_data = {
backendId: seat.id,
seatCategoryId: seat.seat_category_id,
Expand Down
2 changes: 1 addition & 1 deletion app/operations/admin/settings/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def perform
entered_values[key] = value

if config.valid?
AppConfig.send("#{key}=", value)
AppConfig.send(:"#{key}=", value)
else
model.errors.merge!(config.errors)
end
Expand Down
2 changes: 1 addition & 1 deletion app/operations/api/v1/event/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Index < RailsOps::Operation
def result
result = []

Queries::Event::FetchFutureEvents.run.where(published: true).each do |event|
Queries::Event::FetchFutureEvents.run.where(published: true).find_each do |event|
result << {
title: event.title,
description: event.description,
Expand Down
2 changes: 1 addition & 1 deletion app/operations/api/v1/news/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Index < RailsOps::Operation
def result
result = []

:: NewsPost.where(published: true).each do |news_post|
:: NewsPost.where(published: true).find_each do |news_post|
result << {
title: news_post.title,
content: news_post.content,
Expand Down
2 changes: 1 addition & 1 deletion app/operations/lan/seat_map/load_seats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def data
seats: []
}

seat_map.seats.includes(:seat_category, ticket: :assignee).each do |seat|
seat_map.seats.includes(:seat_category, ticket: :assignee).find_each do |seat|
seat_data = {
backendId: seat.id,
seatCategoryId: seat.seat_category_id,
Expand Down
2 changes: 1 addition & 1 deletion app/operations/shop/order/cleanup_untouched.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CleanupUntouched < RailsOps::Operation
def perform
# Delete other orders for user that have status `created`
ActiveRecord::Base.transaction do
Order.where(user: context.user, status: 'created').each do |order|
Order.where(user: context.user, status: 'created').find_each do |order|
Operations::Shop::Order::CleanupSingleOrder.run order: order
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/shop/orders/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
%td{ colspan: 3 }= _('Order|Total')
%td= money_formatted(model.total)

= op.product_behaviour_hints.join.html_safe # rubocop:disable Rails/OutputSafety
= op.product_behaviour_hints.join.html_safe # rubocop:disable Rails/OutputSafety
2 changes: 1 addition & 1 deletion app/views/tournament_teams/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- if op.teams.none?
%tr
%td= _('Tournament|No teams')
- op.teams.includes(:users).each do |team|
- op.teams.includes(:users).find_each do |team|
%tr
%td
= link_to team.name, team_path(team)
Expand Down
2 changes: 1 addition & 1 deletion app/views/tournament_teams/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
color: :danger

-# Then the other users
- model.team_members.includes(:user).each do |team_member|
- model.team_members.includes(:user).find_each do |team_member|
- next if team_member.captain?

.d-flex.justify-content-between.align-items-center.border-bottom.py-2
Expand Down

0 comments on commit 80c8bdf

Please sign in to comment.