From a030aafd4d81d3317b92fa9a0fb23842242b2b72 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Sun, 28 Jul 2024 20:10:58 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20gaptime,=20color=20=EA=B5=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/traffic/service/model/PredictTargetTraffic.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/walking/api/traffic/service/model/PredictTargetTraffic.kt b/src/main/kotlin/com/walking/api/traffic/service/model/PredictTargetTraffic.kt index 534007c..31036c7 100644 --- a/src/main/kotlin/com/walking/api/traffic/service/model/PredictTargetTraffic.kt +++ b/src/main/kotlin/com/walking/api/traffic/service/model/PredictTargetTraffic.kt @@ -87,14 +87,18 @@ class PredictTargetTraffic( while (gapTime > 0) { if (color.isRed) { color = GREEN - gapTime -= greenCycle!! + gapTime -= redCycle!! } else { color = RED - gapTime -= redCycle!! + gapTime -= greenCycle!! } } log.info("Predicted Gap Time: $gapTime") - currentColor = color + currentColor = if (color.isRed) { + RED + } else { + GREEN + } currentTimeLeft = abs(gapTime) log.info("Predicted Color: $currentColor, Predicted Time Left: $currentTimeLeft")