[object Object]

← back to Estimate Instant

estimate-instant: fix half-drop math (consume match), honest capture copy, remove admin link from public page (contrarian FIX-FIRST)

324b6db7d6495c0b287942e46a9934d124d5ebe6 · 2026-07-14 10:14:12 -0700 · Steve

Files touched

Diff

commit 324b6db7d6495c0b287942e46a9934d124d5ebe6
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jul 14 10:14:12 2026 -0700

    estimate-instant: fix half-drop math (consume match), honest capture copy, remove admin link from public page (contrarian FIX-FIRST)
---
 public/index.html | 4 ++--
 server.js         | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/public/index.html b/public/index.html
index 63bcec1..effe93e 100644
--- a/public/index.html
+++ b/public/index.html
@@ -68,11 +68,11 @@
           <input id="email" type="email" placeholder="you@email.com">
           <button id="send">Send quote</button>
         </div>
-        <div class="done" id="done" style="display:none">✓ Sent — we'll email your quote and can help you order.</div>
+        <div class="done" id="done" style="display:none">✓ Saved — a DW rep will follow up with your quote and can help you order.</div>
       </div>
     </div>
   </div>
-  <p class="foot">Estimates include a standard 4" trim + pattern-repeat allowance. Confirm with your DW rep before ordering. · <a href="/admin.html">admin</a></p>
+  <p class="foot">Estimate only — includes a standard 4" trim + pattern-repeat allowance and rounds up for a safe count. Prices are indicative; confirm quantity, price, and dye lot with your DW rep before ordering.</p>
 </div>
 <script>
 let unit='ft', rolls=[], last=null;
diff --git a/server.js b/server.js
index 171c307..3a8f0f9 100644
--- a/server.js
+++ b/server.js
@@ -36,7 +36,12 @@ function estimate({ wallWidthIn, wallHeightIn, roll }) {
   const rawCut = H + TRIM_ALLOWANCE_IN;
   const cutLen = repeat > 0 ? Math.ceil(rawCut / repeat) * repeat : rawCut;
 
-  const stripsPerRoll = Math.floor(rollLenIn / cutLen);
+  // Half-drop match: alternating strips start a half-repeat lower, so a half-repeat
+  // of each roll is consumed establishing the offset — reduces usable strips/roll
+  // (never under-counts, which would leave an installer short mid-wall).
+  const isHalfDrop = String(roll.match || '').toLowerCase() === 'half-drop' && repeat > 0;
+  const usableRollIn = isHalfDrop ? rollLenIn - repeat / 2 : rollLenIn;
+  const stripsPerRoll = Math.floor(usableRollIn / cutLen);
   if (stripsPerRoll < 1) {
     return { ok: false, errors: [`Wall is too tall for this roll — one drop (${cutLen}") exceeds the ${rollLenIn}" roll length. Pick a longer roll or split the wall.`] };
   }

← 25a1126 estimate-instant v0: rolls-needed + instant-price calculator  ·  back to Estimate Instant  ·  estimate-instant: add embeddable widget (embed.js iframe sni 6ec2a7c →