Store Path._directions as a JSON array

The column is of type `JSON`,
but the code stored a JSON-encoded string in it;
so, the data was encoded twice.

A later data migration converts the existing rows.
This commit is contained in:
Alexander Hess 2026-12-02 09:03:27 +01:00
commit bbd7d6a279
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -1,7 +1,5 @@
"""Test the ORM's `Path` model."""
import json
import googlemaps as gm
import pytest
import sqlalchemy as sa
@ -28,12 +26,10 @@ def path(address, another_address, make_address):
# We put 5 latitude-longitude pairs as the "path" from
# `.first_address` to `.second_address`.
directions = json.dumps(
[
(float(add.latitude), float(add.longitude))
for add in (make_address() for _ in range(5))
],
)
directions = [
[float(add.latitude), float(add.longitude)]
for add in (make_address() for _ in range(5))
]
return db.Path(
first_address=address,