style: format codebase
This commit is contained in:
@@ -25,7 +25,7 @@ defmodule ComponentsElixir.Inventory.StorageLocation do
|
||||
timestamps(type: :naive_datetime_usec)
|
||||
end
|
||||
|
||||
@doc false
|
||||
@doc false
|
||||
def changeset(storage_location, attrs) do
|
||||
storage_location
|
||||
|> cast(attrs, [:name, :description, :parent_id, :apriltag_id])
|
||||
@@ -40,7 +40,7 @@ defmodule ComponentsElixir.Inventory.StorageLocation do
|
||||
# HierarchicalSchema implementations
|
||||
@impl true
|
||||
def full_path(%StorageLocation{} = storage_location) do
|
||||
Hierarchical.full_path(storage_location, &(&1.parent), path_separator())
|
||||
Hierarchical.full_path(storage_location, & &1.parent, path_separator())
|
||||
end
|
||||
|
||||
@impl true
|
||||
@@ -80,11 +80,12 @@ defmodule ComponentsElixir.Inventory.StorageLocation do
|
||||
|
||||
defp get_next_available_apriltag_id do
|
||||
# Get all used AprilTag IDs
|
||||
used_ids = ComponentsElixir.Repo.all(
|
||||
from sl in ComponentsElixir.Inventory.StorageLocation,
|
||||
where: not is_nil(sl.apriltag_id),
|
||||
select: sl.apriltag_id
|
||||
)
|
||||
used_ids =
|
||||
ComponentsElixir.Repo.all(
|
||||
from sl in ComponentsElixir.Inventory.StorageLocation,
|
||||
where: not is_nil(sl.apriltag_id),
|
||||
select: sl.apriltag_id
|
||||
)
|
||||
|
||||
# Find the first available ID (0-586)
|
||||
0..586
|
||||
@@ -93,7 +94,9 @@ defmodule ComponentsElixir.Inventory.StorageLocation do
|
||||
nil ->
|
||||
# All IDs are used - this should be handled at the application level
|
||||
raise "All AprilTag IDs are in use"
|
||||
id -> id
|
||||
|
||||
id ->
|
||||
id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user