diff --git a/index1.html b/index1.html index dc37469..ca16904 100644 --- a/index1.html +++ b/index1.html @@ -257,8 +257,8 @@

Quick Overview

- + @@ -677,6 +677,29 @@

Product Tags

"hat_width": 0, "hood_height": 0, }, + "4": { + "chest": 590, + "waist": 560, + "sleeve": 250, + "sleeve_top_width": 232, + "wrist_width": 185, + "underbust": 0, + "neck_opening_width": 0, + "shoulder_width": 139, + "front_height": 760, + "pant_waist": 0, + "hips": 570, + "inseam": 0, + "outseam": 0, + "thigh_width": 0, + "knee_width": 0, + "calf_width": 0, + "pant_sleeve_width": 0, + "shoe_inside_length": 0, + "shoe_inside_width": 0, + "hat_width": 0, + "hood_height": 0, + }, "5": { "chest": 560, "waist": 540, @@ -700,7 +723,6 @@

Product Tags

"hat_width": 0, "hood_height": 0, }, - } } }; diff --git a/index1s.html b/index1s.html index dbd3454..5ebbe4c 100644 --- a/index1s.html +++ b/index1s.html @@ -267,13 +267,13 @@

Quick Overview

- +
S M L - XL + XL
@@ -304,7 +304,7 @@

Quick Overview

"oldPrice": "0", "products": ["18"] }, { - "id": "4", + "id": "41", "label": "XL", "price": "0", "oldPrice": "0", @@ -629,7 +629,7 @@

Product Tags

"SS16_M2180B_BLUE_S": "7", "SS16_M2180B_BLUE_M": "6", "SS16_M2180B_BLUE_L": "5", - "SS16_M2180B_BLUE_XL": "4", + "SS16_M2180B_BLUE_XL": "41", } }; //]]> @@ -715,7 +715,7 @@

Product Tags

"hat_width": 0, "hood_height": 0, }, - "4": { + "41": { "chest": 590, "waist": 570, "sleeve": 260, @@ -806,7 +806,7 @@

Product Tags

  • - +
  • diff --git a/src/api/sizeme-api.js b/src/api/sizeme-api.js index afd4a0f..b528227 100644 --- a/src/api/sizeme-api.js +++ b/src/api/sizeme-api.js @@ -374,19 +374,18 @@ function getRecommendedFit (fitResults, optimalFit) { .filter(([, res]) => res.accuracy > 0) .reduce(([accSize, fit], [size, res]) => { if ((res.totalFit < 1000) && (optFit >= 1000)) return [accSize, fit]; + let maxStretchArr = []; + Object.entries(res.matchMap).forEach(([oKey, oValue]) => { maxStretchArr.push( oValue.componentStretch / stretchFactor(oKey) ); }); + const maxStretch = Math.max.apply(null, maxStretchArr); + const newFit = (Math.abs(res.totalFit - optFit) * 100) + Math.abs(maxStretch - optStretch); if (useStretchingMath(res.matchMap, optFit)) { - let maxStretchArr = []; - Object.entries(res.matchMap).forEach(([oKey, oValue]) => { maxStretchArr.push( oValue.componentStretch / stretchFactor(oKey) ); }); - const maxStretch = Math.max.apply(null, maxStretchArr); - const newFit = (Math.abs(res.totalFit - 1000) * 100) + Math.abs(maxStretch - optStretch); - if (newFit <= (maxDist * 100) && (!accSize || newFit < fit)) { + if ((newFit <= (maxDist * 100)) && ((!accSize) || (newFit < fit))) { return [size, newFit]; } else { return [accSize, fit]; } } else { - const newFit = Math.abs(res.totalFit - optFit); - if ((newFit <= maxDist) && (res.totalFit >= 1000) && ((!accSize) || (newFit < fit))) { + if ((newFit <= (maxDist * 100)) && (res.totalFit >= 1000) && ((!accSize) || (newFit < fit))) { return [size, newFit]; } else { return [accSize, fit];