function updatePoints(data){
    const ideas_wrap = document.getElementById("ideas-panel")
    // find it in ideas panel
    let found = false
    for(let i = 0; i < ideas_wrap.childNodes.length && !found; i++){
        const node = ideas_wrap.childNodes[i];
        if(node.getAttribute('id') == data.idea_id){
            found = true;
            $(node).find(".idea-points").text(data.points);
            // const header_nodes = node.childNodes[0].childNodes[0].childNodes;
            // // If the card to be updated is from some user, so it has 3 elements in header (arrows + points text)
            // if(header_nodes.length == 3){
            //     node.childNodes[0].childNodes[0].childNodes[2].innerText = data.points
            // }
            // else if(header_nodes.length == 1){
            //     // If the card to be updated is from current user, so it has 1 element in header (points, NO ARROWS)
            //     node.childNodes[0].childNodes[0].childNodes[0].innerText = data.points
            // }
        }
    }

    // find it in messages
    const msgs_wrap = document.getElementById("msgs-list")
    found = false;
    for (let i = 0; i < msgs_wrap.childNodes.length && !found; i++) {
        const node = msgs_wrap.childNodes[i]; // div.message
        if (node.getAttribute('attachment-id') == data.idea_id) {
            found = true;
            $(node).find(".idea-points").text(data.points);
        //     const header = node.childNodes[1].childNodes[1].childNodes[0].childNodes[0];
        //     // If the card to be updated is from some user, so it has 3 elements in header (arrows + points text)
        //     if (header.childNodes.length == 3) {
        //         header.childNodes[2].innerText = data.points
        //     }
        //     else if (header.childNodes.length == 1) {
        //         // If the card to be updated is from current user, so it has 1 element in header (points, NO ARROWS)
        //         header.childNodes[0].innerText = data.points
        //     }
        }
    }
}
// Callback to be called when someone else adds a point
Callback to be called when someone else adds a point
Callback to be called when someone else adds a point
function updatePoints(data){
    const ideas_wrap = document.getElementById("ideas-panel")
    let found = false
    for(let i = 0; i < ideas_wrap.childNodes.length && !found; i++){
        const node = ideas_wrap.childNodes[i];
        if(node.getAttribute('id') == data.idea_id){
            found = true;
            $(node).find(".idea-points").text(data.points);
        }
    }
    const msgs_wrap = document.getElementById("msgs-list")
    found = false;
    for (let i = 0; i < msgs_wrap.childNodes.length && !found; i++) {
        const node = msgs_wrap.childNodes[i]; 
        if (node.getAttribute('attachment-id') == data.idea_id) {
            found = true;
            $(node).find(".idea-points").text(data.points);
        }
    }
}
function updatePoints ( data ) { const ideas_wrap = document . getElementById ( "ideas-panel" ) let found = false for ( let i = 0 ; i < ideas_wrap . childNodes . length && ! found ; i ++ ) { const node = ideas_wrap . childNodes [ i ] ; if ( node . getAttribute ( 'id' ) == data . idea_id ) { found = true ; $ ( node ) . find ( ".idea-points" ) . text ( data . points ) ; } } const msgs_wrap = document . getElementById ( "msgs-list" ) found = false ; for ( let i = 0 ; i < msgs_wrap . childNodes . length && ! found ; i ++ ) { const node = msgs_wrap . childNodes [ i ] ; if ( node . getAttribute ( 'attachment-id' ) == data . idea_id ) { found = true ; $ ( node ) . find ( ".idea-points" ) . text ( data . points ) ; } } }
Callback to be called when someone else adds a point
Callback to be called when someone else adds a point
// find it in ideas panel // const header_nodes = node.childNodes[0].childNodes[0].childNodes; // // If the card to be updated is from some user, so it has 3 elements in header (arrows + points text) // if(header_nodes.length == 3){ //     node.childNodes[0].childNodes[0].childNodes[2].innerText = data.points // } // else if(header_nodes.length == 1){ //     // If the card to be updated is from current user, so it has 1 element in header (points, NO ARROWS) //     node.childNodes[0].childNodes[0].childNodes[0].innerText = data.points // } // find it in messages // div.message //     const header = node.childNodes[1].childNodes[1].childNodes[0].childNodes[0]; //     // If the card to be updated is from some user, so it has 3 elements in header (arrows + points text) //     if (header.childNodes.length == 3) { //         header.childNodes[2].innerText = data.points //     } //     else if (header.childNodes.length == 1) { //         // If the card to be updated is from current user, so it has 1 element in header (points, NO ARROWS) //         header.childNodes[0].innerText = data.points //     }