style: correct coding style with rubocop linter

This commit is contained in:
kbe
2025-09-05 12:02:44 +02:00
parent 46c8faf10c
commit 15e3c7dff5
40 changed files with 121 additions and 1663 deletions

View File

@@ -48,5 +48,4 @@ class Event < ApplicationRecord
# Scope for published events ordered by start time
scope :upcoming, -> { published.where("start_time >= ?", Time.current).order(start_time: :asc) }
end

View File

@@ -90,4 +90,4 @@ class Order < ApplicationRecord
def draft?
status == "draft"
end
end
end

View File

@@ -12,7 +12,7 @@ class TicketType < ApplicationRecord
validates :sale_end_at, presence: true
validates :minimum_age, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 120 }, allow_nil: true
validates :event_id, presence: true
validates :requires_id, inclusion: { in: [true, false] }
validates :requires_id, inclusion: { in: [ true, false ] }
# Custom validations
validate :sale_end_after_start
@@ -22,7 +22,7 @@ class TicketType < ApplicationRecord
scope :available_now, -> { where("sale_start_at <= ? AND sale_end_at >= ?", Time.current, Time.current) }
scope :upcoming, -> { where("sale_start_at > ?", Time.current) }
scope :expired, -> { where("sale_end_at < ?", Time.current) }
# Helper methods
def price_euros
return 0.0 if price_cents.nil?
@@ -45,7 +45,7 @@ class TicketType < ApplicationRecord
def available_quantity
return 0 if quantity.nil?
[quantity - tickets.count, 0].max
[ quantity - tickets.count, 0 ].max
end
def sales_status
@@ -53,7 +53,7 @@ class TicketType < ApplicationRecord
return :expired if sale_end_at < Time.current
return :upcoming if sale_start_at > Time.current
return :sold_out if sold_out?
return :available
:available
end
def total_potential_revenue