Skip to content

Commit

Permalink
fix(place/demo/lockers): add debugging info
Browse files Browse the repository at this point in the history
when parsing in configuration
  • Loading branch information
stakach committed Dec 19, 2024
1 parent 1fc0c7e commit 26104b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
18 changes: 9 additions & 9 deletions drivers/place/attendee_scanner_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ class LocationServices < DriverSpecs::MockDriver
self[:building_id_requested] = true
"zone-building"
end

def systems
self[:systems_requested] = true
{
"zone-level1": [
"spec_runner_system",
],
}
end
end

# :nodoc:
Expand All @@ -33,6 +24,15 @@ class StaffAPI < DriverSpecs::MockDriver
}
end

def systems_in_building(zone_id : String, ids_only : Bool = true)
self[:systems_requested] = zone_id
{
"zone-level1": [
"spec_runner_system",
],
}
end

def get_system(id : String, complete : Bool = false)
raise "unexpected system requested #{id}" unless id == "spec_runner_system"

Expand Down
7 changes: 6 additions & 1 deletion drivers/place/demo/lockers.cr
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ class Place::Demo::Lockers < PlaceOS::Driver
def lockers_details(level_id : String) : Array(LockerBank)
lockers = staff_api.metadata(level_id, "lockers").get.dig?("lockers", "details")
return [] of LockerBank unless lockers
Array(LockerBank).from_json(lockers.to_json)
begin
Array(LockerBank).from_json(lockers.to_json)
rescue error
logger.warn(exception: error) { "error parsing locker json on level #{level_id}:\n#{lockers.to_pretty_json}" }
[] of LockerBank
end
end

class ::PlaceOS::Driver::Interface::Lockers::PlaceLocker
Expand Down

0 comments on commit 26104b1

Please sign in to comment.