From 68c351df1a01a489f112c2e2352ac53d60ef2b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20K=C3=B6n=C3=B6nen?= Date: Fri, 17 Mar 2023 20:03:13 +0200 Subject: [PATCH] Fix pant waist recommendation bug * if only pant_waist meas given and useStretchingMath is true, then compare as fitRec = 1000 etc. --- index1t.html | 771 ++++++++++++++++++++++++++++++++++++++++++ src/api/sizeme-api.js | 3 +- webpack.config.js | 1 + 3 files changed, 774 insertions(+), 1 deletion(-) create mode 100644 index1t.html diff --git a/index1t.html b/index1t.html new file mode 100644 index 0000000..8f59bae --- /dev/null +++ b/index1t.html @@ -0,0 +1,771 @@ + + + + HALTI HIKER PANTS (PRODUCT-DB) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ +
+
+ +
+

Default welcome msg!

+ +
+ + +
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+ + +
+ +
+
+

HALTI HIKER PANTS (PRODUCT-DB)

+
+ + + +

Be + the first to review this product

+ +

Availability: In stock

+ + +
+ + €10.00 + +
+ + +
+

Quick Overview

+
HALTI HIKER PANTS with Product DB
+
+ + +
+ +
+
+
+
+ +
+
+
+ + + + + +

* Required Fields

+
+ +
+ + +
+ + €10.00 + +
+ +
+ + + +
+ + + +
+ +
+ +
+

+ T-SHIRT (PRODUCT-DB)

+

Double click on above image to view full + picture

+
+ Zoom Out +
+
+
+ Zoom In +
+ +
+

More Views

+
    +
  • + +
  • +
+
+
+ +
+
+ +
+ +
+
+

Details

+
+ Just a HALTI HIKER PANTS with measurements from the SizeMe Product Database +
+
+
+

Product Tags

+
+
+ +
+ +
+ +
+
+

Use spaces to separate tags. Use single quotes (') for phrases.

+ +
+
+
+ + + + + +
+ +
+
+ + + +
+
+ + + + + + + \ No newline at end of file diff --git a/src/api/sizeme-api.js b/src/api/sizeme-api.js index 9eb64d2..cd54ffb 100644 --- a/src/api/sizeme-api.js +++ b/src/api/sizeme-api.js @@ -382,14 +382,15 @@ function getRecommendedFit (fitResults, optimalFit) { 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)) { + const newFit = (Math.abs(res.totalFit - 1000) * 100) + Math.abs(maxStretch - DEFAULT_OPTIMAL_STRETCH); if ((newFit <= (maxDist * 100)) && ((!accSize) || (newFit < fit))) { return [size, newFit]; } else { return [accSize, fit]; } } else { + const newFit = (Math.abs(res.totalFit - optFit) * 100) + Math.abs(maxStretch - optStretch); if ((newFit <= (maxDist * 100)) && (res.totalFit >= 1000) && ((!accSize) || (newFit < fit))) { return [size, newFit]; } else { diff --git a/webpack.config.js b/webpack.config.js index 0605978..0284b22 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -79,6 +79,7 @@ const developmentConfig = () => merge([ parts.page({ template: "index1f.html", filename: "index1f.html" }), parts.page({ template: "index1h1.html", filename: "index1h1.html" }), parts.page({ template: "index1s.html", filename: "index1s.html" }), + parts.page({ template: "index1t.html", filename: "index1t.html" }), parts.page({ template: "index2.html", filename: "index2.html" }), parts.page({ template: "index2r.html", filename: "index2r.html" }), parts.page({ template: "index2kk.html", filename: "index2kk.html" }),