singhn9 commited on
Commit
bfe36c7
·
verified ·
1 Parent(s): c90ce2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -10
app.py CHANGED
@@ -719,10 +719,22 @@ function draw() {
719
  let transfers = TRANSFERS.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
720
  let loops = LOOPS.filter(x=>x[0]===nodeName || x[2]===nodeName).map(x=>x[0]===nodeName?x[2]:x[0]);
721
 
722
- // <-- NEW: include FRESH edges so teal arcs behave like real connections
723
  let fresh = FRESH.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
 
 
 
 
 
 
 
 
 
 
 
 
724
 
725
- return new Set([].concat(buys, sells, transfers, loops, fresh));
726
  }
727
 
728
 
@@ -786,18 +798,19 @@ function draw() {
786
  const loops = LOOPS.filter(x => x[0]===nodeName || x[2]===nodeName)
787
  .map(x => x[0]===nodeName ? x[2] : x[0]);
788
 
789
- // NEW — detect Fresh Buys
790
  const fresh = FRESH.filter(x => x[0] === nodeName || x[1] === nodeName)
791
  .map(x => x[0] === nodeName ? x[1] : x[0]);
792
 
793
- // NEW — detect Complete Exits
794
- const exits = [];
795
- COMPLETE_EXIT = __COMPLETE_EXIT__; // inject the map (see below)
 
796
  if (COMPLETE_EXIT[nodeName]) {
797
- exits.push(...COMPLETE_EXIT[nodeName]);
 
 
798
  }
799
-
800
-
801
 
802
  const box = document.getElementById("info-box");
803
  box.innerHTML = `
@@ -807,7 +820,7 @@ function draw() {
807
  <b>Sells:</b> ${sells.length ? sells.join(", ") : "<span style='color:#777'>None</span>"}<br>
808
  <b>Transfers:</b> ${transfers.length ? transfers.join(", ") : "<span style='color:#777'>None</span>"}<br>
809
  <b>Loops:</b> ${loops.length ? loops.join(", ") : "<span style='color:#777'>None</span>"}<br>
810
- <b>Fresh Buys:</b> ${fresh.length ? fresh.join(", ") : "<span style='color:#777'>None</span>"}
811
  <b>Complete Exits:</b> ${exits.length ? exits.join(", ") : "<span style='color:#777'>None</span>"}<br>
812
  </div>
813
  `;
 
719
  let transfers = TRANSFERS.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
720
  let loops = LOOPS.filter(x=>x[0]===nodeName || x[2]===nodeName).map(x=>x[0]===nodeName?x[2]:x[0]);
721
 
722
+ // include FRESH edges
723
  let fresh = FRESH.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
724
+
725
+ // include COMPLETE_EXIT connections:
726
+ // - if nodeName is an AMC, include companies in COMPLETE_EXIT[nodeName]
727
+ // - if nodeName is a company, include AMCs that list that company in their COMPLETE_EXIT
728
+ let exits = [];
729
+ if (COMPLETE_EXIT[nodeName]) {
730
+ // nodeName is an AMC
731
+ exits = exits.concat(COMPLETE_EXIT[nodeName]);
732
+ } else {
733
+ // nodeName may be a company; find AMCs that have it
734
+ exits = exits.concat(Object.keys(COMPLETE_EXIT).filter(amc => (COMPLETE_EXIT[amc] || []).includes(nodeName)));
735
+ }
736
 
737
+ return new Set([].concat(buys, sells, transfers, loops, fresh, exits));
738
  }
739
 
740
 
 
798
  const loops = LOOPS.filter(x => x[0]===nodeName || x[2]===nodeName)
799
  .map(x => x[0]===nodeName ? x[2] : x[0]);
800
 
801
+ // detect Fresh Buys
802
  const fresh = FRESH.filter(x => x[0] === nodeName || x[1] === nodeName)
803
  .map(x => x[0] === nodeName ? x[1] : x[0]);
804
 
805
+ // detect Complete Exits:
806
+ // if nodeName is AMC, list companies they completely exited
807
+ // if nodeName is company, list AMCs who completely exited that company
808
+ let exits = [];
809
  if (COMPLETE_EXIT[nodeName]) {
810
+ exits = exits.concat(COMPLETE_EXIT[nodeName]); // nodeName is AMC
811
+ } else {
812
+ exits = exits.concat(Object.keys(COMPLETE_EXIT).filter(amc => (COMPLETE_EXIT[amc] || []).includes(nodeName)));
813
  }
 
 
814
 
815
  const box = document.getElementById("info-box");
816
  box.innerHTML = `
 
820
  <b>Sells:</b> ${sells.length ? sells.join(", ") : "<span style='color:#777'>None</span>"}<br>
821
  <b>Transfers:</b> ${transfers.length ? transfers.join(", ") : "<span style='color:#777'>None</span>"}<br>
822
  <b>Loops:</b> ${loops.length ? loops.join(", ") : "<span style='color:#777'>None</span>"}<br>
823
+ <b>Fresh Buys:</b> ${fresh.length ? fresh.join(", ") : "<span style='color:#777'>None</span>"}<br>
824
  <b>Complete Exits:</b> ${exits.length ? exits.join(", ") : "<span style='color:#777'>None</span>"}<br>
825
  </div>
826
  `;