From 8ff7bc51e5e285e7cb7037d9190a845a330254e6 Mon Sep 17 00:00:00 2001 From: Patrick Tang <36460266+patricksptang@users.noreply.github.com> Date: Wed, 27 Dec 2023 19:10:07 -0800 Subject: [PATCH] fix lookup of morphology --- pom.xml | 2 +- step-assembly/pom.xml | 2 +- step-build/pom.xml | 2 +- step-core-data/pom.xml | 2 +- step-core/pom.xml | 2 +- step-packages/pom.xml | 2 +- step-server/pom.xml | 2 +- step-test/pom.xml | 2 +- step-tools/pom.xml | 2 +- step-war-precompiled/pom.xml | 2 +- step-web-test/pom.xml | 2 +- step-web/pom.xml | 2 +- step-web/src/main/webapp/js/step.util.js | 44 ++++++++++++++++++------ 13 files changed, 45 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index e72b5954eb..83c6e77418 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 pom STEP :: Scripture Tools for Every pastor diff --git a/step-assembly/pom.xml b/step-assembly/pom.xml index e526bd4e15..6c8298b6d7 100644 --- a/step-assembly/pom.xml +++ b/step-assembly/pom.xml @@ -5,7 +5,7 @@ step-mvn com.tyndalehouse.step - 23.12.4 + 23.12.5 4.0.0 diff --git a/step-build/pom.xml b/step-build/pom.xml index 9047aaf45f..fd89ffb1a6 100644 --- a/step-build/pom.xml +++ b/step-build/pom.xml @@ -4,7 +4,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 step-build diff --git a/step-core-data/pom.xml b/step-core-data/pom.xml index 8b62b109c1..4124cf3f91 100644 --- a/step-core-data/pom.xml +++ b/step-core-data/pom.xml @@ -7,7 +7,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 step-core-data diff --git a/step-core/pom.xml b/step-core/pom.xml index e6cfcfa77b..064362856b 100644 --- a/step-core/pom.xml +++ b/step-core/pom.xml @@ -4,7 +4,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 com.tyndalehouse.step diff --git a/step-packages/pom.xml b/step-packages/pom.xml index 4e99db5b20..53c52998f8 100644 --- a/step-packages/pom.xml +++ b/step-packages/pom.xml @@ -5,7 +5,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 com.tyndalehouse.step diff --git a/step-server/pom.xml b/step-server/pom.xml index 669c8775f4..55279bea84 100644 --- a/step-server/pom.xml +++ b/step-server/pom.xml @@ -2,7 +2,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 4.0.0 diff --git a/step-test/pom.xml b/step-test/pom.xml index 8de0237b72..839eb87951 100644 --- a/step-test/pom.xml +++ b/step-test/pom.xml @@ -6,7 +6,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 com.tyndalehouse.step diff --git a/step-tools/pom.xml b/step-tools/pom.xml index 870d179161..7f852d351e 100644 --- a/step-tools/pom.xml +++ b/step-tools/pom.xml @@ -4,7 +4,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 com.tyndalehouse.step diff --git a/step-war-precompiled/pom.xml b/step-war-precompiled/pom.xml index 3b9e85566f..99f28caadb 100644 --- a/step-war-precompiled/pom.xml +++ b/step-war-precompiled/pom.xml @@ -5,7 +5,7 @@ step-mvn com.tyndalehouse.step - 23.12.4 + 23.12.5 4.0.0 diff --git a/step-web-test/pom.xml b/step-web-test/pom.xml index a8f9ca1e48..7fe3210784 100644 --- a/step-web-test/pom.xml +++ b/step-web-test/pom.xml @@ -5,7 +5,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 com.tyndalehouse.step diff --git a/step-web/pom.xml b/step-web/pom.xml index 146c6760be..e69aac1b6f 100644 --- a/step-web/pom.xml +++ b/step-web/pom.xml @@ -4,7 +4,7 @@ com.tyndalehouse.step step-mvn - 23.12.4 + 23.12.5 step-web diff --git a/step-web/src/main/webapp/js/step.util.js b/step-web/src/main/webapp/js/step.util.js index 603fe11ce8..b2b3681333 100644 --- a/step-web/src/main/webapp/js/step.util.js +++ b/step-web/src/main/webapp/js/step.util.js @@ -3831,8 +3831,11 @@ step.util = { } } } - if (indexToUniqueStrongArry == -1) - alert("something wrong, cannot locate original search Strong in getVocabMorphInfoFromJson"); + if (indexToUniqueStrongArry == -1) { + console.log("something wrong, cannot locate original search Strong in getVocabMorphInfoFromJson"); + callBackLoadDefFromAPI(callBack2Param); + return; + } for (var i = 0; i < origJsonVar.v.length; i++) { if (uniqueStrongArray[indexToUniqueStrongArry] !== requestedStrong) { // requestedStrong does not have augment var strongNumToCheck = (typeof origJsonVar.v[i][0] === "number") ? origJsonVar.d[origJsonVar.v[i][0]] : origJsonVar.v[i][0]; @@ -3869,25 +3872,44 @@ step.util = { if (morph) { var numOfMorphResponse = 0; var morphArray = morph.split(" "); + resultJson.morphInfos = new Array(morphArray.length); for (var k = 0; k < morphArray.length; k++) { - numOfMorphResponse ++; - var morph = morphArray[k]; - var morphLowerCase = morph.toLowerCase(); + var currentMorph = morphArray[k]; + var morphLowerCase = currentMorph.toLowerCase(); if ((morphLowerCase.indexOf("strongsmorph:") > -1) || (morphLowerCase.indexOf("strongmorph:") > -1) || (morphLowerCase.indexOf("tos:") > -1)) continue; - var pos = morph.search("robinson:"); - if (pos > -1) morph = morphArray[k].substring(pos+9); - $.getJSON("/html/lexicon/" + additionalPath + morph + ".json", function(jsonVar) { + var pos = morphLowerCase.search("robinson:"); // need to check to see if this is still used + if (pos > -1) currentMorph = currentMorph.substring(pos+9); + $.getJSON("/html/lexicon/" + additionalPath + currentMorph + ".json", function(jsonVar) { + var indexToUniqueMorphArry = -1; + var requestedMorph = ""; + if (morphArray.length > 1) { + if (this.url.search("\/([^.]+)\\.json$") > -1) { + requestedMorph = RegExp.$1; + for (var j = 0; j < morphArray.length; j++) { + if (requestedMorph === morphArray[j]) { + indexToUniqueMorphArry = j; + break; + } + } + } + } + else // most of the time, there is only one morph for SBLG, THGNT and THOT + indexToUniqueMorphArry = 0; + if (indexToUniqueMorphArry == -1) { + console.log("something wrong, cannot locate original search morph in getVocabMorphInfoFromJson"); + callBackLoadDefFromAPI(callBack2Param); + return; + } numOfMorphResponse ++; - resultJson.morphInfos.push(jsonVar.morphInfos[0]); + resultJson.morphInfos[indexToUniqueMorphArry] = jsonVar.morphInfos[0]; if (numOfMorphResponse == morphArray.length) callProcessQuickInfo(resultJson, callBack1Param); }).error(function() { - console.log("getJSon failed strong:"+ strong + " morph: " + morph + " version: " + version); + console.log("getJSon failed strong:"+ strong + " morph: " + currentMorph + " version: " + version); if (numOfMorphResponse < 0) return; // already processed error from $getjson of /html/lexicon ... numOfMorphResponse = -100; callBackLoadDefFromAPI(callBack2Param); - //return false; }); } }