From 3d6041207626b152408bd8f60e7a10660ffe2c2b Mon Sep 17 00:00:00 2001 From: ansons Date: Sun, 17 Mar 2024 21:23:38 -0400 Subject: [PATCH] fix(grid-dual-access): properly trigger with flag --- .../java/com/conveyal/r5/analyst/TravelTimeReducer.java | 2 +- .../conveyal/r5/analyst/cluster/AnalysisWorkerTask.java | 4 ++++ .../conveyal/r5/analyst/cluster/RegionalWorkResult.java | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/conveyal/r5/analyst/TravelTimeReducer.java b/src/main/java/com/conveyal/r5/analyst/TravelTimeReducer.java index a4d5c50b2..8fe50efc3 100644 --- a/src/main/java/com/conveyal/r5/analyst/TravelTimeReducer.java +++ b/src/main/java/com/conveyal/r5/analyst/TravelTimeReducer.java @@ -145,7 +145,7 @@ public TravelTimeReducer (AnalysisWorkerTask task, TransportNetwork network) { if (task.includePathResults) { pathResult = new PathResult(task, network.transitLayer); } - if (task.includeTemporalDensity || task.flags.contains("gridDualAccess")) { + if (task.includeTemporalDensity || task.hasFlag("gridDualAccess")) { temporalDensityResult = new TemporalDensityResult(task); } diff --git a/src/main/java/com/conveyal/r5/analyst/cluster/AnalysisWorkerTask.java b/src/main/java/com/conveyal/r5/analyst/cluster/AnalysisWorkerTask.java index 2698905fa..59a6936a6 100644 --- a/src/main/java/com/conveyal/r5/analyst/cluster/AnalysisWorkerTask.java +++ b/src/main/java/com/conveyal/r5/analyst/cluster/AnalysisWorkerTask.java @@ -323,4 +323,8 @@ public void validateCutoffsMinutes () { } } + public boolean hasFlag (String flag) { + return this.flags != null && this.flags.contains(flag); + } + } diff --git a/src/main/java/com/conveyal/r5/analyst/cluster/RegionalWorkResult.java b/src/main/java/com/conveyal/r5/analyst/cluster/RegionalWorkResult.java index 7f10e77b8..e57bb09de 100644 --- a/src/main/java/com/conveyal/r5/analyst/cluster/RegionalWorkResult.java +++ b/src/main/java/com/conveyal/r5/analyst/cluster/RegionalWorkResult.java @@ -63,7 +63,13 @@ public RegionalWorkResult(OneOriginResult result, RegionalTask task) { this.jobId = task.jobId; this.taskId = task.taskId; this.travelTimeValues = result.travelTimes == null ? null : result.travelTimes.values; - this.accessibilityValues = result.accessibility == null ? null : result.density.fakeDualAccess(task); + if (result.accessibility == null) { + this.accessibilityValues = null; + } else if (task.flags.contains("gridDualAccess")) { + this.accessibilityValues = result.density.fakeDualAccess(task); + } else { + this.accessibilityValues = result.accessibility.getIntValues(); + } this.pathResult = result.paths == null ? null : result.paths.summarizeIterations(PathResult.Stat.MINIMUM); this.opportunitiesPerMinute = result.density == null ? null : result.density.opportunitiesPerMinute; // TODO checkTravelTimeInvariants, checkAccessibilityInvariants to verify that values are monotonically increasing