app/static/scripts/globalScripts.js
// for now, this will delete tree and rebuild
for now, this will delete tree and rebuild
for now this will delete tree and rebuild
function update_tree() {
    removeAllChildNodes(svg_holder);
    removeAllChildNodes(tree_container);
    tree_container.append(svg_holder);
    for( let person of PERSON_ARRAY) {
        person.hasCard = false;
        person.cardHolder = undefined;
        person.branchLevel = undefined;
        person.cardNumber = undefined;
        person.sibling_div = undefined;
    }
    for( let person of PERSON_ARRAY) {
        if(person.assignedRoot) {
            build_tree(person);
        }
    }
    console.log('UPDATED TREE - ', PERSON_ARRAY, RELATION_ARRAY);
}
function update_tree ( ) { removeAllChildNodes ( svg_holder ) ; removeAllChildNodes ( tree_container ) ; tree_container . append ( svg_holder ) ; for ( let person of PERSON_ARRAY ) { person . hasCard = false ; person . cardHolder = undefined ; person . branchLevel = undefined ; person . cardNumber = undefined ; person . sibling_div = undefined ; } for ( let person of PERSON_ARRAY ) { if ( person . assignedRoot ) { build_tree ( person ) ; } } console . log ( 'UPDATED TREE - ' , PERSON_ARRAY , RELATION_ARRAY ) ; }
for now, this will delete tree and rebuild
for now this will delete tree and rebuild
// crude way of finding root right now. as there is no way to change the root yet //remove all cards // empty svg_holder // empty tree container. // add back the svg_holder? // unset some properties determined in build_tree // find person with assignedRoot value and pass to build tree