<commit_before>hqDefine("aaa/js/models/child", [
    'jquery',
    'knockout',
    'underscore',
    'moment/moment',
    'hqwebapp/js/initial_page_data',
    'aaa/js/models/person',
    'aaa/js/models/model_utils',
    'aaa/js/utils/chart_const',
], function (
    $,
    ko,
    _,
    moment,
    initialPageData,
    personUtils,
    modelUtils,
    chartConst
) {
    var childList = function (options, postData) {
        var self = {};
        self.id = options.id;
        self.name = ko.observable(options.name);
        self.age = ko.observable(options.age);
        self.gender = ko.observable(options.gender);
        self.lastImmunizationType = ko.observable(options.lastImmunizationType);
        self.lastImmunizationDate = ko.observable(options.lastImmunizationDate);

        self.name = ko.computed(function () {
            var url = initialPageData.reverse('unified_beneficiary_details');
            url = url.replace('details_type', 'child');
            url = url.replace('beneficiary_id', self.id);
            url = url + '?month=' + postData.selectedMonth() + '&year=' + postData.selectedYear();
            return '<a href="' + url + '">' + self.name() + '</a>';
        });

        self.age = ko.computed(function () {
            var age = parseInt(self.age());
            if (age < 12) {
                return age + " Mon";
            } else if (age % 12 === 0) {
                return Math.floor(age / 12) + " Yr";
            } else {
                return Math.floor(age / 12) + " Yr " + age % 12 + " Mon";
            }
        });

        self.lastImmunizationType = ko.computed(function () {
            return self.lastImmunizationType() === 1 ? 'Yes' : 'No';
        });

        return self;
    };

    var childListConfig = function () {
        var self = {};
        self.columns = [
            {data: 'name()', name: 'name', title: 'Name'},
            {data: 'age()', name: 'age', title: 'Age'},
            {data: 'gender()', name: 'gender', title: 'Gender'},
            {data: 'lastImmunizationType()', name: 'lastImmunizationType', title: 'Last Immunization Type'},
            {data: 'lastImmunizationDate()', name: 'lastImmunizationDate', title: 'Last Immunization Date'},
        ];
        return self;
    };


    var childModel = function (data, postData) {<commit_msg>show N/A in last immunization date when no immunization type<commit_after>hqDefine("aaa/js/models/child", [
    'jquery',
    'knockout',
    'underscore',
    'moment/moment',
    'hqwebapp/js/initial_page_data',
    'aaa/js/models/person',
    'aaa/js/models/model_utils',
    'aaa/js/utils/chart_const',
], function (
    $,
    ko,
    _,
    moment,
    initialPageData,
    personUtils,
    modelUtils,
    chartConst
) {
    var childList = function (options, postData) {
        var self = {};
        self.id = options.id;
        self.name = ko.observable(options.name);
        self.age = ko.observable(options.age);
        self.gender = ko.observable(options.gender);
        self.lastImmunizationType = ko.observable(options.lastImmunizationType);
        self.lastImmunizationDate = ko.observable(options.lastImmunizationDate);

        self.name = ko.computed(function () {
            var url = initialPageData.reverse('unified_beneficiary_details');
            url = url.replace('details_type', 'child');
            url = url.replace('beneficiary_id', self.id);
            url = url + '?month=' + postData.selectedMonth() + '&year=' + postData.selectedYear();
            return '<a href="' + url + '">' + self.name() + '</a>';
        });

        self.age = ko.computed(function () {
            var age = parseInt(self.age());
            if (age < 12) {
                return age + " Mon";
            } else if (age % 12 === 0) {
                return Math.floor(age / 12) + " Yr";
            } else {
                return Math.floor(age / 12) + " Yr " + age % 12 + " Mon";
            }
        });

        self.lastImmunizationType = ko.computed(function () {
            return self.lastImmunizationType() === 1 ? 'Yes' : 'No';
        });

        self.lastImmunizationDate = ko.computed(function () {
            return options.lastImmunizationType === null ? 'N/A' : self.lastImmunizationDate();
        });

        return self;
    };

    var childListConfig = function () {
        var self = {};
        self.columns = [
            {data: 'name()', name: 'name', title: 'Name'},
            {data: 'age()', name: 'age', title: 'Age'},
            {data: 'gender()', name: 'gender', title: 'Gender'},
            {data: 'lastImmunizationType()', name: 'lastImmunizationType', title: 'Last Immunization Type'},
            {data: 'lastImmunizationDate()', name: 'lastImmunizationDate', title: 'Last Immunization Date'},
        ];
        return self;
    };


    var childModel = function (data, postData) {
{'fraction_non_alphanumeric': 0.15642915642915642, 'fraction_numerical': 0.004914004914004914, 'mean_word_length': 2.137443802183687, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3617130', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1440, 'n_words': 300}