Autocorrect Style/SafeNavigation

This commit is contained in:
Henne Vogelsang 2024-12-02 11:46:33 +01:00
parent 68e8203f27
commit e1e7c18586
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
2 changed files with 3 additions and 6 deletions

View file

@ -196,10 +196,7 @@ class Conference < ApplicationRecord
# ====Returns # ====Returns
# * +Array+ -> e.g. [0, 3, 3, 5] -> first week 0, second week 3 registrations # * +Array+ -> e.g. [0, 3, 3, 5] -> first week 0, second week 3 registrations
def get_registrations_per_week def get_registrations_per_week
return [] unless registrations && return [] unless registrations && registration_period&.start_date && registration_period.end_date
registration_period &&
registration_period.start_date &&
registration_period.end_date
reg = registrations.group(:week).order(:week).count reg = registrations.group(:week).order(:week).count
start_week = get_registration_start_week start_week = get_registration_start_week

View file

@ -82,13 +82,13 @@ class EventSchedule < ApplicationRecord
end end
def start_after_end_hour def start_after_end_hour
return unless event && start_time && event.program && event.program.conference && event.program.conference.end_hour return unless event && start_time && event.program&.conference && event.program.conference.end_hour
errors.add(:start_time, "can't be after the conference end hour (#{event.program.conference.end_hour})") if start_time.hour >= event.program.conference.end_hour errors.add(:start_time, "can't be after the conference end hour (#{event.program.conference.end_hour})") if start_time.hour >= event.program.conference.end_hour
end end
def start_before_start_hour def start_before_start_hour
return unless event && start_time && event.program && event.program.conference && event.program.conference.start_hour return unless event && start_time && event.program&.conference && event.program.conference.start_hour
errors.add(:start_time, "can't be before the conference start hour (#{event.program.conference.start_hour})") if start_time.hour < event.program.conference.start_hour errors.add(:start_time, "can't be before the conference start hour (#{event.program.conference.start_hour})") if start_time.hour < event.program.conference.start_hour
end end