From c91f44c2da1f7455dc3ba30767346e503cffc070 Mon Sep 17 00:00:00 2001 From: dev-karpov0 Date: Wed, 27 Sep 2023 22:36:47 +1000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=81=D0=BE=D0=B2=D0=BF=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=83=D0=BD=D0=BA=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B8=20=D0=BD=D0=B0=D0=B7=D0=BD=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VVSU/show_route.js | 4 ++++ VVSU/styles.css | 4 ++-- find_route.js | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/VVSU/show_route.js b/VVSU/show_route.js index e1d2f20..f1268da 100644 --- a/VVSU/show_route.js +++ b/VVSU/show_route.js @@ -24,6 +24,10 @@ function showRoute() case RouteFinderStatus.INVALID_DESTINATION: errorText.innerHTML = `Пункт ${to_point} отсутствует`; break; + + case RouteFinderStatus.DEST_AND_SRC_EQUAL: + errorText.innerHTML = "Пункты отправления и назначения совпадают"; + break; } errorText.hidden = false; return; diff --git a/VVSU/styles.css b/VVSU/styles.css index deec5fd..2283854 100644 --- a/VVSU/styles.css +++ b/VVSU/styles.css @@ -22,7 +22,7 @@ body { } .container { - width: 310px; + width: 315px; /*background-color: #141718;*/ background-color: transparent; margin: 0 auto; @@ -75,7 +75,7 @@ body { .form { margin: 20px auto 0px auto; padding: 0 0 15px 0; - width: 300px; + width: 310px; } .form form { diff --git a/find_route.js b/find_route.js index e3aba74..1973edf 100644 --- a/find_route.js +++ b/find_route.js @@ -132,7 +132,7 @@ function get_route_text (route) return route_text; } -const RouteFinderStatus = {SUCCESS:0, INVALID_SOURCE: 1, INVALID_DESTINATION: 2}; +const RouteFinderStatus = {SUCCESS:0, INVALID_SOURCE: 1, INVALID_DESTINATION: 2, DEST_AND_SRC_EQUAL: 3}; function findRoute (point_from, point_to) { @@ -144,6 +144,10 @@ function findRoute (point_from, point_to) let status = RouteFinderStatus.SUCCESS; let route_strs = [`Маршрут от ${point_from} до ${point_to}`]; + if (point_from === point_to) { + status = RouteFinderStatus.DEST_AND_SRC_EQUAL + } + if (!plan.point_by_id.has(point_from)) { //route_strs.push(`Пункт ${point_from} отсутствует`); status = RouteFinderStatus.INVALID_SOURCE;