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:
parent
eb294e9b14
commit
8c96fa5bc1
11 changed files with 32 additions and 10 deletions
|
|
@ -6,6 +6,9 @@ All notable changes to this project are documented here. The project follows
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- "Meet halfway" on a renewal now offers the price halfway between what the customer pays and what they ask, and the button shows it before you press (#293).
|
||||
- Fujairah sits on the UAE's east coast again, where its cables land, instead of on top of Muscat (#295).
|
||||
|
||||
## [2.10.0] — 2026-11-05
|
||||
|
||||
**The map now runs on your graphics card.** Panning, zooming and fast play stay smooth even on huge networks. If something looks wrong or your phone gets warm, switch back to the old map in **Settings › Map drawing › Always 2D**. Older browsers stay in 2D on their own, and Settings › Diagnostic info shows which one you have.
|
||||
|
|
|
|||
|
|
@ -2627,7 +2627,7 @@
|
|||
"lifecycle.market_below":"{p} unter deinem Start",
|
||||
"lifecycle.match":"Mitgehen",
|
||||
"lifecycle.matched":"{name} hat zum gewünschten Preis verlängert.",
|
||||
"lifecycle.meet_halfway":"In der Mitte treffen",
|
||||
"lifecycle.meet_halfway":"In der Mitte treffen: {price}",
|
||||
"lifecycle.meet_no":"{name} hat das Angebot der Konkurrenz genommen und ist weg.",
|
||||
"lifecycle.meet_yes":"{name} hat dein Angebot angenommen und für {price}/Monat verlängert.",
|
||||
"lifecycle.moved_stays":"{name} ist von {from} nach {to} gezogen, wo du einen POP hast, und bleibt also.",
|
||||
|
|
|
|||
|
|
@ -2625,7 +2625,7 @@
|
|||
"lifecycle.market_below":"{p} por debajo de cuando empezaste",
|
||||
"lifecycle.match":"Igualar",
|
||||
"lifecycle.matched":"{name} renovó al precio que pidió.",
|
||||
"lifecycle.meet_halfway":"Partir la diferencia",
|
||||
"lifecycle.meet_halfway":"Partir la diferencia: {price}",
|
||||
"lifecycle.meet_no":"{name} aceptó la oferta de la competencia y se fue.",
|
||||
"lifecycle.meet_yes":"{name} aceptó tu oferta y renovó por {price}/mes.",
|
||||
"lifecycle.moved_stays":"{name} se mudó de {from} a {to}, donde tienes POP, así que se queda.",
|
||||
|
|
|
|||
|
|
@ -2625,7 +2625,7 @@
|
|||
"lifecycle.market_below":"{p} en dessous de vos débuts",
|
||||
"lifecycle.match":"S'aligner",
|
||||
"lifecycle.matched":"{name} a renouvelé au prix demandé.",
|
||||
"lifecycle.meet_halfway":"Couper la poire en deux",
|
||||
"lifecycle.meet_halfway":"Couper la poire en deux : {price}",
|
||||
"lifecycle.meet_no":"{name} a pris l'offre du concurrent et est partie.",
|
||||
"lifecycle.meet_yes":"{name} a accepté votre offre et renouvelé à {price}/mois.",
|
||||
"lifecycle.moved_stays":"{name} a déménagé de {from} à {to}, où vous avez un POP : elle reste.",
|
||||
|
|
|
|||
|
|
@ -2625,7 +2625,7 @@
|
|||
"lifecycle.market_below":"{p} sotto a quando hai iniziato",
|
||||
"lifecycle.match":"Accettare",
|
||||
"lifecycle.matched":"{name} ha rinnovato al prezzo richiesto.",
|
||||
"lifecycle.meet_halfway":"Venirsi incontro",
|
||||
"lifecycle.meet_halfway":"Venirsi incontro: {price}",
|
||||
"lifecycle.meet_no":"{name} ha preso l'offerta del concorrente e se n'è andata.",
|
||||
"lifecycle.meet_yes":"{name} ha accettato la tua offerta e rinnovato a {price}/mese.",
|
||||
"lifecycle.moved_stays":"{name} si è trasferita da {from} a {to}, dove hai un POP, quindi resta.",
|
||||
|
|
|
|||
|
|
@ -2625,7 +2625,7 @@
|
|||
"lifecycle.market_below":"{p} abaixo do começo",
|
||||
"lifecycle.match":"Igualar",
|
||||
"lifecycle.matched":"{name} renovou pelo preço que pediu.",
|
||||
"lifecycle.meet_halfway":"Meio-termo",
|
||||
"lifecycle.meet_halfway":"Meio-termo: {price}",
|
||||
"lifecycle.meet_no":"{name} aceitou a proposta do concorrente e foi embora.",
|
||||
"lifecycle.meet_yes":"{name} aceitou sua proposta e renovou por {price}/mês.",
|
||||
"lifecycle.moved_stays":"{name} mudou de {from} para {to}, onde você tem POP, então fica.",
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -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)})):'';
|
||||
|
||||
|
|
|
|||
|
|
@ -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();},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2626,7 +2626,7 @@
|
|||
"lifecycle.market_below":"{p} below when you started",
|
||||
"lifecycle.match":"Match",
|
||||
"lifecycle.matched":"{name} renewed at the price they asked.",
|
||||
"lifecycle.meet_halfway":"Meet halfway",
|
||||
"lifecycle.meet_halfway":"Meet halfway: {price}",
|
||||
"lifecycle.meet_no":"{name} took the competitor's bid and left.",
|
||||
"lifecycle.meet_yes":"{name} took your offer and renewed at {price}/mo.",
|
||||
"lifecycle.moved_stays":"{name} moved from {from} to {to}, where you have a POP, so it stays.",
|
||||
|
|
|
|||
|
|
@ -120,6 +120,22 @@ test('a haggle: 30 days ahead, in Deals; match, meet halfway, let go, or no answ
|
|||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('meeting halfway lands between what the customer pays and what they ask, as the button says (#293)', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
// The market has fallen a lot since they signed, so the old reference (today's fair price) sat right next to the ask.
|
||||
// A name whose roll accepts the offer: the rolls are hashes of the deal, so the test picks one, never luck.
|
||||
const id = ev(`(()=>{for(let i=0;i<200;i++){const b={id:'m'+i,city:'ams',city2:null,name:'m'+i,type:'dia',bw:5,rate:1000,reqs:[],mood:90,since:S.day-800,te:S.day+20,mk:2,hag:{rate:700,until:S.day+20}};if(clR(b,'meet')<salesMeet()){S.biz.push(b);return b.id;}}return null;})()`);
|
||||
assert.ok(id, 'a customer that takes the offer');
|
||||
ev("UI.left='deals';renderLeft()");
|
||||
const deals = ev("document.getElementById('leftBody')?document.getElementById('leftBody').innerHTML:document.getElementById('left').innerHTML");
|
||||
assert.ok(deals.includes(ev('fmt$(5*850)')), `the button shows the halfway bill, ${ev('fmt$(5*850)')}`);
|
||||
ev(`ACT.renewMeet({id:'${id}'})`);
|
||||
assert.equal(B(ev, id, 'rate'), 850, 'halfway between 1000 and 700');
|
||||
assert.equal(B(ev, id, 'hag'), undefined);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the bandwidth market: flat for six months, then cheaper each year, up in a shortage, 1 without the market rule', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue