Un-pydantic FlightWaypoint.

Apparently it's a bad idea to try to make the core data pydantic models,
and those should really be treated more as a view-model. Doing otherwise
causes odd patterns (like the UI info I had leaked into the core type),
and makes it harder to interop with third-party types.
This commit is contained in:
Dan Albert
2022-02-21 23:10:28 -08:00
parent c5ab0431a9
commit 3e08e0e8b6
7 changed files with 305 additions and 286 deletions

View File

@@ -768,7 +768,7 @@ class Waypoint {
}
position() {
return this.waypoint.latlng;
return this.waypoint.position;
}
shouldMark() {
@@ -783,10 +783,8 @@ class Waypoint {
}
async description(dragging) {
const alt = Math.floor(
this.waypoint.alt.distance_in_meters * METERS_TO_FEET
);
const altRef = this.waypoint.alt_type == "BARO" ? "MSL" : "AGL";
const alt = this.waypoint.altitude_ft;
const altRef = this.waypoint.altitude_reference;
return (
`${this.number} ${this.waypoint.name}<br />` +
`${alt} ft ${altRef}<br />` +