← back to Flock Fix Viewer
Fix normalized flock dimension verification
78a3bee3c6022431c63f1f3f6ecd7e3aa1448b90 · 2026-09-02 17:32:21 -0700 · Steve Abrams
Files touched
M spec-privatelabel-flock.mjs
Diff
commit 78a3bee3c6022431c63f1f3f6ecd7e3aa1448b90
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Sep 2 17:32:21 2026 -0700
Fix normalized flock dimension verification
---
spec-privatelabel-flock.mjs | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/spec-privatelabel-flock.mjs b/spec-privatelabel-flock.mjs
index 1bda3f4..0dfad4f 100644
--- a/spec-privatelabel-flock.mjs
+++ b/spec-privatelabel-flock.mjs
@@ -23,9 +23,14 @@ const HOUSE=[ // [globalKey, customKey, value]
['print_type','print_type','Flock'],
['material','material','Flocked Velvet'],
];
-// parse width_in + single-roll length_ft from strings like 20.5"x16.5' | 20.5" x 16.5' per single roll
-function parseWL(s){ if(!s) return null;
- const nums=(String(s).match(/[\d.]+/g)||[]).map(parseFloat);
+// Parse width_in + single-roll length_ft from either the original combined width
+// value (20.5"x16.5') or the normalized width/length metafield pair.
+function parseWL(width,length){ if(!width) return null;
+ const nums=(String(width).match(/[\d.]+/g)||[]).map(parseFloat);
+ if(nums.length<2 && length){
+ const lengthNums=(String(length).match(/[\d.]+/g)||[]).map(parseFloat);
+ if(lengthNums.length) nums.push(lengthNums[0]);
+ }
if(nums.length<2) return null;
const [w,l]=nums;
if(!(w>=12&&w<=56)) return null; // sane flock width in inches
@@ -38,6 +43,7 @@ function parseWL(s){ if(!s) return null;
edges{node{ id handle title
variants(first:4){edges{node{sku title}}}
w:metafield(namespace:"global",key:"width"){value}
+ l:metafield(namespace:"global",key:"length"){value}
gpt:metafield(namespace:"global",key:"print_type"){value}
}}}}`;
do{const r=await gql(Q,{c:cur});const p=r?.data?.products;if(!p){console.error(JSON.stringify(r));break;}all=all.concat(p.edges);cur=p.pageInfo.hasNextPage?p.pageInfo.endCursor:null;}while(cur);
@@ -46,8 +52,8 @@ function parseWL(s){ if(!s) return null;
console.log('active Phillipe Romano ROP/ERE/PRNC flock:',targets.length);
const snap=[]; let applied=0, skipped=[];
for(const n of targets){
- const wl=parseWL(n.w?.value);
- if(!wl){ skipped.push(`${rollSku(n)} bad-width "${n.w?.value}"`); continue; }
+ const wl=parseWL(n.w?.value,n.l?.value);
+ if(!wl){ skipped.push(`${rollSku(n)} bad-dimensions width="${n.w?.value}" length="${n.l?.value}"`); continue; }
const sr=r2((wl.wi/12)*wl.lenft), dr=r2(sr*2);
const pairs=[
['width',null,`${wl.wi} in`],
← fc17f16 href-drill-canary: fix flock-fix-viewer flat grid — per-card
·
back to Flock Fix Viewer
·
Mark Shopify links as record drills 49dfe0d →