From d1958faa0263734e607284fea56b3c6f994c2a92 Mon Sep 17 00:00:00 2001 From: bponders12-cell Date: Tue, 1 Sep 2026 10:50:19 -0400 Subject: [PATCH] chore: remove one-time route event patch workflow --- .github/workflows/route-event-patch.yml | 39 ------------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/route-event-patch.yml diff --git a/.github/workflows/route-event-patch.yml b/.github/workflows/route-event-patch.yml deleted file mode 100644 index 9f872a3..0000000 --- a/.github/workflows/route-event-patch.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Patch route event rendering - -on: - push: - branches: [master] - -permissions: - contents: write - -jobs: - patch: - if: github.actor != 'github-actions[bot]' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Expand acceleration and braking events to surrounding GPS points - shell: python - run: | - from pathlib import Path - - path = Path('lib/features/map/map_screen.dart') - text = path.read_text() - old = ''' List _buildLongitudinalEventPolylines(\n List samples, {\n required bool Function(double g) predicate,\n required String idPrefix,\n required Color color,\n }) {\n final polylines = [];\n List segment = [];\n var segmentIndex = 0;\n\n void flush() {\n if (segment.length >= 2) {\n polylines.add(AppPolyline(\n id: '${idPrefix}_$segmentIndex',\n points: List.from(segment),\n color: color,\n width: 7.0,\n ));\n segmentIndex++;\n }\n segment = [];\n }\n\n for (final sample in samples) {\n final g = sample.longitudinalG ?? sample.accelX;\n if (g != null && g.isFinite && predicate(g)) {\n segment.add(AppLatLng(sample.latitude!, sample.longitude!));\n } else {\n flush();\n }\n }\n flush();\n return polylines;\n }''' - new = ''' List _buildLongitudinalEventPolylines(\n List samples, {\n required bool Function(double g) predicate,\n required String idPrefix,\n required Color color,\n }) {\n if (samples.isEmpty) return [];\n\n // A threshold crossing is often only one telemetry sample wide. Requiring\n // two consecutive qualifying samples made isolated acceleration/braking\n // events disappear from the map. Build event runs, then include one GPS\n // sample on each side so every event renders as a visible route segment.\n final polylines = [];\n final eventIndices = [];\n\n for (var i = 0; i < samples.length; i++) {\n final g = samples[i].longitudinalG ?? samples[i].accelX;\n if (g != null && g.isFinite && predicate(g)) {\n eventIndices.add(i);\n }\n }\n if (eventIndices.isEmpty) return polylines;\n\n var runStart = eventIndices.first;\n var runEnd = eventIndices.first;\n var segmentIndex = 0;\n\n void emitRun(int start, int end) {\n final expandedStart = start > 0 ? start - 1 : start;\n final expandedEnd = end < samples.length - 1 ? end + 1 : end;\n final points = [];\n for (var i = expandedStart; i <= expandedEnd; i++) {\n final sample = samples[i];\n points.add(AppLatLng(sample.latitude!, sample.longitude!));\n }\n\n // The surrounding point guarantees two points for an isolated event\n // while preserving a single continuous segment for adjacent events.\n if (points.length >= 2) {\n polylines.add(AppPolyline(\n id: '${idPrefix}_$segmentIndex',\n points: points,\n color: color,\n width: 7.0,\n ));\n segmentIndex++;\n }\n }\n\n for (var i = 1; i < eventIndices.length; i++) {\n final index = eventIndices[i];\n // Keep nearby threshold samples in one event run. A gap of more than\n // two samples starts a new visual event while allowing brief sensor\n // dropouts inside a hard maneuver.\n if (index - runEnd <= 2) {\n runEnd = index;\n } else {\n emitRun(runStart, runEnd);\n runStart = runEnd = index;\n }\n }\n emitRun(runStart, runEnd);\n\n return polylines;\n }''' - if old not in text: - raise SystemExit('Expected route event polyline function was not found; refusing to modify the file.') - path.write_text(text.replace(old, new, 1)) - - - name: Commit route event fix - shell: bash - run: | - git config user.name 'github-actions[bot]' - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git add lib/features/map/map_screen.dart - git commit -m 'fix: render isolated route acceleration and braking events' - git push