Meet halfway between the bill and the ask; Fujairah back on its coast (#293, #295)

Meeting halfway split the difference between the ask and today's market
price, which after a fall in prices sat right next to the ask. It now
splits the two prices the Deals row shows, and the button names it.
Fujairah's display nudge moved it a degree south onto Muscat; it now
sits on the UAE's east coast where its cables land.
This commit is contained in:
Frederic Jung 2026-11-05 17:10:22 +01:00
parent eb294e9b14
commit 8c96fa5bc1
No known key found for this signature in database
11 changed files with 32 additions and 10 deletions

View file

@ -453,7 +453,7 @@ const CITY_NUDGE={
dxb:[9,-7],
fec:[-10.8,1.4],
fln:[0.8,4.4],
fuj:[8,15],
fuj:[2,2],
gdl:[-1.2,0.2],
gyn:[-4,2.6],
hel:[-.8,-.2],

View file

@ -109,13 +109,16 @@ function clReferral(d){if(d%45!==0||S.offers.length>=6)return;
// New offers are priced at today's market (spawnOffer and friends price at 1; this moves them).
function mktPrice(from){const m=mkt();for(let i=from;i<S.offers.length;i++){const o=S.offers[i];if(o.mk)continue;o.mk=m;if(m!==1){o.rate=Math.round(o.rate*m);if(o.fee)o.fee=Math.round(o.fee*m);}}}
// Meeting halfway: between what the customer pays now and what they ask, the two prices the Deals row shows (#293).
const clMid=b=>Math.round((b.rate+b.hag.rate)/2);
const clBill=(b,rate)=>BIZ_T[b.type].fiber?rate:b.bw*rate;
const clHags=()=>S?S.biz.reduce((a,b)=>a+(b.hag?1:0),0):0;
// The renewals waiting for an answer, at the top of Deals.
function clDealsHtml(){const hs=S.biz.filter(b=>b.hag).sort((a,b)=>a.hag.until-b.hag.until);if(!hs.length)return '';
return `<h3 class="sub4">${tr('lifecycle.renewals')}</h3><p class="meta" style="margin:0 0 6px">${tr('lifecycle.unanswered_matches')}</p>`+hs.map(b=>{const now=BIZ_T[b.type].fiber?b.hag.rate:b.bw*b.hag.rate,was=bizMo(b);
return `<div class="row"><div class="grow"><div class="nm">${esc(b.name)}</div><div class="meta">${esc(BIZ_T[b.type].l)} · ${esc(clWhere(b))} · ${tr('ui.n_d_left',{n:b.hag.until-S.day})}</div>
<div class="meta">${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}</div>
<div class="btns">${btn(tr('lifecycle.match'),'renewMatch',{id:b.id},'green sm')}${btn(tr('lifecycle.meet_halfway'),'renewMeet',{id:b.id},'sm')}${btn(tr('lifecycle.let_them_go'),'renewLet',{id:b.id},'ghost sm')}</div></div></div>`;}).join('');}
<div class="btns">${btn(tr('lifecycle.match'),'renewMatch',{id:b.id},'green sm')}${btn(tr('lifecycle.meet_halfway',{price:fmt$(clBill(b,clMid(b)))}),'renewMeet',{id:b.id},'sm')}${btn(tr('lifecycle.let_them_go'),'renewLet',{id:b.id},'ghost sm')}</div></div></div>`;}).join('');}
// The contract line on a customer row.
const clTermTxt=b=>clOn(b)&&b.te?(b.hag?tr('lifecycle.renewal_haggle',{date:dateStr(b.te)}):tr('lifecycle.contract_until',{date:dateStr(b.te)})):'';

View file

@ -24,8 +24,8 @@ Object.assign(ACT,{
function clHagOf(id){const b=S.biz.find(x=>x.id===id);return b&&b.hag?b:null;}
Object.assign(ACT,{
renewMatch:({id})=>{const b=clHagOf(id);if(!b)return;clRenew(b,b.hag.rate);clNote('ren');toast(tr('lifecycle.matched',{name:esc(b.name)}),'good');sfx('coin');after();},
renewMeet:({id})=>{const b=clHagOf(id);if(!b)return;const mid=Math.round((b.hag.rate+clFair(b))/2);
if(clR(b,'meet')<salesMeet()){clRenew(b,mid);clNote('ren');toast(tr('lifecycle.meet_yes',{name:esc(b.name),price:fmt$(BIZ_T[b.type].fiber?b.rate:b.bw*b.rate)}),'good');sfx('coin');}
renewMeet:({id})=>{const b=clHagOf(id);if(!b)return;const mid=clMid(b);
if(clR(b,'meet')<salesMeet()){clRenew(b,mid);clNote('ren');toast(tr('lifecycle.meet_yes',{name:esc(b.name),price:fmt$(clBill(b,b.rate))}),'good');sfx('coin');}
else{clGone(b,'cheap');toast(tr('lifecycle.meet_no',{name:esc(b.name)}),'bad');sfx('err');}after();},
renewLet:({id})=>{const b=clHagOf(id);if(!b)return;clGone(b,'cheap');toast(tr('lifecycle.let_go',{name:esc(b.name)}),'');after();},
});