<commit_before>define(['jquery', 
    'underscore', 
    'summernote', 
    'views/forms/base',
    'views/forms/sections/validation',
    'views/forms/sections/branch-list',
    'bootstrap-datetimepicker'], function ($, _, summernote, BaseForm, ValidationTools, BranchList) {
    
    var vt = new ValidationTools;
    
    return BaseForm.extend({
        
        initialize: function() {
            BaseForm.prototype.initialize.apply(this);
            
            var resourcetypeid = $('#resourcetypeid').val();

            this.addBranchList(new BranchList({
                el: this.$el.find('#classification-section')[0],
                data: this.data,
                dataKey: 'PHASE_TYPE_ASSIGNMENT.E17',
                validateBranch: function (nodes) {
                    if (resourcetypeid == "HERITAGE_RESOURCE.E18"){
                        return vt.nodesHaveValues(nodes,['HERITAGE_RESOURCE_TYPE.E55','CULTURAL_PERIOD.E55']);
                    }
                    if (resourcetypeid == "HERITAGE_RESOURCE_GROUP.E27"){
                        return vt.nodesHaveValues(nodes,['HERITAGE_RESOURCE_GROUP_TYPE.E55','CULTURAL_PERIOD.E55']);
                    }
                }
            }));
        }
    });
});<commit_msg>implement dependant node validation function<commit_after>define(['jquery', 
    'underscore', 
    'summernote', 
    'views/forms/base',
    'views/forms/sections/validation',
    'views/forms/sections/branch-list',
    'bootstrap-datetimepicker'], function ($, _, summernote, BaseForm, ValidationTools, BranchList) {
    
    var vt = new ValidationTools;
    
    return BaseForm.extend({
        
        initialize: function() {
            BaseForm.prototype.initialize.apply(this);
            
            var resourcetypeid = $('#resourcetypeid').val();

            this.addBranchList(new BranchList({
                el: this.$el.find('#classification-section')[0],
                data: this.data,
                dataKey: 'PHASE_TYPE_ASSIGNMENT.E17',
                validateBranch: function (nodes) {
                    if (resourcetypeid == "HERITAGE_RESOURCE.E18"){
                        var ck1 = vt.nodesHaveValues(nodes,['HERITAGE_RESOURCE_TYPE.E55','CULTURAL_PERIOD.E55']);
                    }
                    if (resourcetypeid == "HERITAGE_RESOURCE_GROUP.E27"){
                        var ck1 = vt.nodesHaveValues(nodes,['HERITAGE_RESOURCE_GROUP_TYPE.E55','CULTURAL_PERIOD.E55']);
                    }
                    var ck2 = vt.dependantNodePair(nodes,'RULER.E55','DYNASTY.E55');
                    return ck1 && ck2
                }
                
            }));
        }
    });
});
{'fraction_non_alphanumeric': 0.12467435802009676, 'fraction_numerical': 0.014514328247115743, 'mean_word_length': 1.850477200424178, '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': '7047510', 'n_tokens_mistral': 831, 'n_tokens_neox': 764, 'n_words': 102}