<commit_before>require([
    'jquery',
    'underscore',
    'knockout',
    'knockout-mapping',
    'views/graph/graph-page-view',
    'graph-cards-data'
], function($, _, ko, koMapping, PageView, data) {

    /**
    * a GraphPageView representing the graph cards page
    */
    var self = this;
    var viewModel = {
        showCardLibrary: ko.observable(false),
        toggleCardLibrary: function(){
            this.showCardLibrary(!this.showCardLibrary());
        }
    }
    viewModel.cardLibraryStatus = ko.pureComputed(function() {
        return this.showCardLibrary() ? 'show-card-library' : 'hide-card-library';
    }, viewModel);
    viewModel.appliedGraphs = ko.observableArray();
    viewModel.availableGraphs = ko.observableArray();

    var findCardOrNode = function(branch, nodegroupid){
        var cardOrNode = _.find(branch.cards, function(card){
            return card.nodegroupid === nodegroupid;
        })
        if(!cardOrNode){
            cardOrNode = _.find(branch.nodes, function(node){
                return node.nodeid === nodegroupid;
            })
        }
        return cardOrNode;
    }
    data.branches.forEach(function(branch){
        branch.card = {'name':'', 'subcards': []}
        branch.nodegroups.forEach(function(nodegroup){
            var cardOrNode = findCardOrNode(branch, nodegroup.nodegroupid);
            if(nodegroup.parentnodegroup_id){
                branch.card.subcards.push({'name':cardOrNode.name});
            }else{
                branch.card.name = cardOrNode.name;
            }
        })
        
        viewModel.availableGraphs.push(branch);
    })
    var pageView = new PageView({
        viewModel: viewModel
    });
});<commit_msg>fix the way cards are identified, re #523<commit_after>require([
    'jquery',
    'underscore',
    'knockout',
    'knockout-mapping',
    'views/graph/graph-page-view',
    'graph-cards-data'
], function($, _, ko, koMapping, PageView, data) {

    /**
    * a GraphPageView representing the graph cards page
    */
    var self = this;
    var viewModel = {
        showCardLibrary: ko.observable(false),
        toggleCardLibrary: function(){
            this.showCardLibrary(!this.showCardLibrary());
        }
    }
    viewModel.cardLibraryStatus = ko.pureComputed(function() {
        return this.showCardLibrary() ? 'show-card-library' : 'hide-card-library';
    }, viewModel);
    viewModel.appliedGraphs = ko.observableArray();
    viewModel.availableGraphs = ko.observableArray();

    var findCardOrNode = function(branch, nodegroupid){
        var cardOrNode = _.find(branch.cards, function(card){
            return card.nodegroup_id === nodegroupid;
        })
        if(!cardOrNode){
            cardOrNode = _.find(branch.nodes, function(node){
                return node.nodeid === nodegroupid;
            })
        }
        return cardOrNode;
    }
    data.branches.forEach(function(branch){
        branch.card = {'name':'', 'subcards': []}
        branch.nodegroups.forEach(function(nodegroup){
            var cardOrNode = findCardOrNode(branch, nodegroup.nodegroupid);
            if(nodegroup.parentnodegroup_id){
                branch.card.subcards.push({'name':cardOrNode.name});
            }else{
                branch.card.name = cardOrNode.name;
            }
        })
        
        viewModel.availableGraphs.push(branch);
    })
    var pageView = new PageView({
        viewModel: viewModel
    });
});
{'fraction_non_alphanumeric': 0.12979521199884628, 'fraction_numerical': 0.0008653014133256418, 'mean_word_length': 2.328214971209213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3740888', 'n_tokens_mistral': 1017, 'n_tokens_neox': 992, 'n_words': 169}