diff --git a/CHANGELOG.md b/CHANGELOG.md index 8549e15..d757761 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- A deal’s “Go there” button takes you to a required city without a POP, instead of returning to a city you already serve. + ## [1.25.1] — 2026-10-25 - Once you have half a billion in the bank, the banks stop sending loan offers diff --git a/site/index.html b/site/index.html index a74d20e..7812e2a 100644 --- a/site/index.html +++ b/site/index.html @@ -2826,7 +2826,7 @@ function renderLeft(){checkLayer(); if(!S.offers.length)h+=`

${tr('No open offers right now. Businesses look for networks with POPs in their city. New ones pop up every few weeks.')}

`; for(const o of S.offers.slice().sort((a,b)=>a.exp-b.exp)){const has=bHas(o); h+=`
${esc(o.name)}
${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · ${bTerms(o)} · ${tr('{n}d left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('{n} special requirement','{n} special requirements',o.reqs.length)}`:''}
${reqList(o)} -
${has?btn(tr('Accept'),'accept',{id:o.id},'green sm'):btn(tr('Go there'),'focusCity',{city:o.city},'ghost sm')}${btn(tr('Decline'),'decline',{id:o.id},'ghost sm')}
${has?'':`
${tr('Needs a POP in {cities}',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}
`}
`;} +
${has?btn(tr('Accept'),'accept',{id:o.id},'green sm'):btn(tr('Go there'),'focusCity',{city:bCities(o).find(c=>!S.pops[c])},'ghost sm')}${btn(tr('Decline'),'decline',{id:o.id},'ghost sm')}
${has?'':`
${tr('Needs a POP in {cities}',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}
`}`;} }else if(UI.left==='noc'){ h+=`
${btn(tr('Open NOC dashboard'),'dash',{},'pink')}${btn(tr('Connections'),'connOpen',{},'')}${btn(tr('Traceroute'),'trace',{},'')}
`; h+=`

${tr('Your Network Operations Center. Every notification also lands here. Things fail all the time on the internet. Redundant links and multiple upstreams let traffic reroute by itself.')}

`; diff --git a/tests/issues.test.js b/tests/issues.test.js index 13b30b8..975d1c2 100644 --- a/tests/issues.test.js +++ b/tests/issues.test.js @@ -539,3 +539,18 @@ test('#35 your own trench can light another fiber pair once a ROADMaster is full assert.equal(ev('S.links[0].pairs'), 4, 'saves are clamped to four pairs'); assert.deepEqual(errors, []); }); + +test('deal navigation visits the first missing POP, including second endpoints and multi-site offers',()=>{ + const {ev,dom,errors}=load();ev("ACT.start({});S.cash=1e8;UI.speed=0;UI.left='deals';UI.leftOpen=true;S.offers=[{id:'route',type:'l2vpn',name:'Missing POP circuit',city:'fra',city2:'bde',bw:10,rate:1000,reqs:[],exp:30}];renderLeft()"); + const go=()=>dom.window.document.querySelector('#leftBody [data-act="focusCity"]'); + assert.equal(JSON.parse(go().dataset.args).city,'bde'); + ev(`ACT.focusCity(${go().dataset.args})`);assert.equal(ev('UI.sel.id'),'bde');assert.equal(ev('!!S.pops.bde'),false,'navigation does not buy a POP'); + ev("S.pops.bde={routers:1,rgen:0};delete S.pops.fra;renderLeft()");assert.equal(JSON.parse(go().dataset.args).city,'fra','the first endpoint can also be missing'); + ev("delete S.pops.bde;renderLeft()");assert.equal(JSON.parse(go().dataset.args).city,'fra','both missing uses the first required city'); + ev("S.pops.fra={routers:1,rgen:0};S.offers[0].type='sdwan';S.offers[0].city2=null;S.offers[0].sites=['fra','ams','par'];window.innerWidth=360;renderLeft()"); + assert.equal(JSON.parse(go().dataset.args).city,'ams'); + ev("S.pops.ams={routers:1,rgen:0};renderLeft()");assert.equal(JSON.parse(go().dataset.args).city,'par'); + ev("S.pops.par={routers:1,rgen:0};renderLeft()");assert.equal(go(),null);assert.ok(dom.window.document.querySelector('#leftBody [data-act="accept"]')); + ev("S.offers[0].type='l2vpn';delete S.offers[0].sites;S.offers[0].city='bde';renderLeft()");assert.equal(JSON.parse(go().dataset.args).city,'bde','single-site offers still work'); + assert.deepEqual(errors,[]); +});