Skip to content

Commit

Permalink
refactor(room_at_capacity_mailer): over capacity counter
Browse files Browse the repository at this point in the history
  • Loading branch information
chillfox committed Feb 12, 2025
1 parent 60d8c15 commit fbd4b40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/place/room_at_capacity_mailer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Place::RoomAtCapacityMailer < PlaceOS::Driver
@over_capactity_detected_count : Int32 = 2

@last_email_sent : Hash(String, Time) = {} of String => Time
@over_capacity : Hash(String, Int32) = {} of String => Int32
@over_capacity : Hash(String, Int32) = Hash(String, Int32).new { |hash, sys_id| hash[sys_id] = 0 }

def on_update
@building_id = nil
Expand All @@ -70,7 +70,7 @@ class Place::RoomAtCapacityMailer < PlaceOS::Driver
logger.debug { "people count for #{system_id}: #{people_count}" }

if people_count >= sys.capacity
@over_capacity[system_id] = @over_capacity[system_id]? ? @over_capacity[system_id] + 1 : 1
@over_capacity[system_id] += 1
else
@over_capacity[system_id] = 0
end
Expand Down

0 comments on commit fbd4b40

Please sign in to comment.