Fix ArgumentError for unknown field :phg in schema
The :phg field was being added as a map to packet attributes, but it's not a database field. PHG data should be split into individual fields (phg_power, phg_height, phg_gain, phg_directivity) which are actual database columns. Removed the :phg map from being added to attributes. The put_phg_fields function already handles extracting individual PHG components. Updated tests to check for individual PHG fields instead of the map. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
623800dfc1
commit
c59744f352
2 changed files with 6 additions and 7 deletions
|
|
@ -381,7 +381,7 @@ defmodule Aprsme.Packet do
|
|||
|> maybe_put(:course, data_extended[:course] || data_extended["course"])
|
||||
|> maybe_put(:speed, data_extended[:speed] || data_extended["speed"])
|
||||
|> maybe_put(:altitude, altitude)
|
||||
|> maybe_put(:phg, phg)
|
||||
# Don't add :phg to the map - it will be split into individual fields by put_phg_fields
|
||||
|> put_phg_fields(data_extended)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -22,16 +22,15 @@ defmodule Aprsme.PacketParsingTest do
|
|||
# Verify altitude was extracted
|
||||
assert extracted_attrs[:altitude] == 680.0
|
||||
|
||||
# Verify PHG data was extracted
|
||||
assert is_map(extracted_attrs[:phg])
|
||||
# Verify PHG data was extracted into individual fields
|
||||
# PHG5 = 25W (5^2)
|
||||
assert extracted_attrs[:phg][:power] == 25
|
||||
assert extracted_attrs[:phg_power] == 25
|
||||
# PHG x5x = 320 ft
|
||||
assert extracted_attrs[:phg][:height] == 320
|
||||
assert extracted_attrs[:phg_height] == 320
|
||||
# PHG xx3 = 3 dBi
|
||||
assert extracted_attrs[:phg][:gain] == 3
|
||||
assert extracted_attrs[:phg_gain] == 3
|
||||
# PHG xxx0 = 0 degrees (not 360 for omni in our implementation)
|
||||
assert extracted_attrs[:phg][:directivity] == 0
|
||||
assert extracted_attrs[:phg_directivity] == 0
|
||||
|
||||
# Verify comment has altitude and PHG removed
|
||||
assert extracted_attrs[:comment] == "Collin Cty Wide Digi"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue