From 4bada97941c29af38c9b2b6b89dde71f24bae54f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 1 Nov 2023 22:33:17 -0400 Subject: [PATCH] index.html.in: return the empty string for unknown MARC zones --- index.html.in | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/index.html.in b/index.html.in index f6094fa..b09f59a 100644 --- a/index.html.in +++ b/index.html.in @@ -545,10 +545,10 @@ BWI_WBL: 1 }; - /* The default. Obviously wrong for when we don't - * have the necessary data. */ - let zone = 0; - + /* Compute the zone (string) for the given origin/destination pair. + * If we don't know it or if you chose in invalid pair (destination + * not on the same line as your origin?) then the empty string is + * returned. */ function compute_marc_zone(src, dest) { /* Forward direction key for zone_map */ const fwd = src + "_" + dest; @@ -558,6 +558,10 @@ * directions here. */ const rev = dest + "_" + src; + /* The default. Obviously wrong for when we don't + * have the necessary data. */ + let zone = -1; + if (zone_map[fwd]) { zone = zone_map[fwd]; } @@ -576,7 +580,7 @@ case 4: return "Four Zone"; default: - return "??? Zone"; + return ""; } } -- 2.44.2