feat(train): routes kept as sealed rows, planned on the map (ADR 0030, D44)
Routes are synced `route` rows (the model `SavedRoute`, as Flutter has a `Route`), sealed as plans are; the migration `routes` only creates the table, its space index and its cascade to the sync engine's spaces. A route's payload holds its name, activity, profile, waypoints and the way planned, points and elevations delta-coded and gzipped. Home gets a fourth tab, Routes, and the planner: waypoints tapped on the map, held and dragged, the last undone, a new route's first where the phone is (GPS through the recorder's channel), the way planned by the instance's BRouter after each change, an earlier answer dropped; its distance, climb, descent, elevation and surfaces under the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
a8f7c26e69
commit
aea99c68ca
1 changed files with 24035 additions and 12 deletions
|
|
@ -53,8 +53,8 @@ void main() {
|
|||
|
||||
test(
|
||||
'deleting a person deletes their space with every key, workout, '
|
||||
"series, profile, day, day's series, night and plan in it, and nobody "
|
||||
"else's",
|
||||
"series, profile, day, day's series, night, plan and route in it, and "
|
||||
"nobody else's",
|
||||
() async {
|
||||
for (final person in [alice, bob]) {
|
||||
await _workoutOf(session, person);
|
||||
|
|
@ -68,6 +68,7 @@ void main() {
|
|||
'day_series',
|
||||
'night',
|
||||
'plan',
|
||||
'route',
|
||||
]) {
|
||||
expect(await rowsOf(alice, table), 1, reason: table);
|
||||
}
|
||||
|
|
@ -93,6 +94,7 @@ void main() {
|
|||
'day_series',
|
||||
'night',
|
||||
'plan',
|
||||
'route',
|
||||
]) {
|
||||
expect(await rowsOf(alice, table), 0, reason: table);
|
||||
expect(await rowsOf(bob, table), 1, reason: table);
|
||||
|
|
@ -119,8 +121,8 @@ void main() {
|
|||
final _syncDatabases = Expando<OfflineSyncDatabase>();
|
||||
|
||||
/// A key, a workout, a series of it, a profile, a day, a series of it, a
|
||||
/// night and a plan in [person]'s personal space, written as their device would through
|
||||
/// the sync engine (payloads stand in for sealed ones: the server never reads
|
||||
/// night, a plan and a route in [person]'s personal space, written as their
|
||||
/// device would through the sync engine (payloads stand in for sealed ones: the server never reads
|
||||
/// them).
|
||||
Future<void> _workoutOf(Session session, UuidValue person) =>
|
||||
_syncDatabases[session]!.transactionForUser(person, (transaction) async {
|
||||
|
|
@ -175,4 +177,9 @@ Future<void> _workoutOf(Session session, UuidValue person) =>
|
|||
Plan(keyId: 'p1.0.key', payload: sealed, nonce: sealed),
|
||||
transaction: transaction,
|
||||
);
|
||||
await SavedRoute.db.insertRow(
|
||||
session,
|
||||
SavedRoute(keyId: 'p1.0.key', payload: sealed, nonce: sealed),
|
||||
transaction: transaction,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue