<commit_before>var rnrModule = angular.module('rnr', ['openlmis', 'ngGrid']).config(['$routeProvider', function ($routeProvider) {
    $routeProvider.
        when('/init-rnr', {controller:InitiateRnrController, templateUrl:'partials/init.html'}).
        when('/create-rnr/:facility/:program/:period', {controller: RequisitionController, templateUrl:'partials/create.html'}).
        when('/rnr-for-approval', {controller: ApproveRnrListController, templateUrl:'partials/list.html', resolve: ApproveRnrListController.resolve}).
        when('/requisitions-for-convert-to-order', {controller: ConvertToOrderListController, templateUrl:'partials/convert-to-order-list.html', resolve: ConvertToOrderListController.resolve}).
        when('/rnr-for-approval/:rnr/:facility/:program', {controller:ApproveRnrController, templateUrl:'partials/approve.html', resolve: ApproveRnrController.resolve}).
        otherwise({redirectTo:'/init-rnr'});
}]).directive('rnrValidator', function () {
        return {
            require:'?ngModel',
            link:function (scope, element, attrs, ctrl) {
                var validationFunction = rnrModule[attrs.rnrValidator];
                ctrl.$parsers.unshift(function (viewValue) {
                    if (validationFunction(viewValue, element.attr('name'))) {
                        ctrl.$setValidity(element.attr('name'), true);
                        ctrl.$setValidity('rnrError', true);
                        if (viewValue == "") viewValue = undefined;
                        return viewValue;
                    } else {
                        ctrl.$setValidity(element.attr('name'), false);
                        if(!attrs['preventRnrError']) ctrl.$setValidity('rnrError', false);
                        return undefined;
                    }
                });
            }
        };
    });

rnrModule.positiveInteger = function (value, errorHolder) {
    var toggleErrorMessageDisplay = function (valid, errorHolder) {
        if (valid) {
            document.getElementById(errorHolder).style.display = 'none';
        } else {
            document.getElementById(errorHolder).style.display = 'block';
        }
    };

    var INTEGER_REGEXP = /^\d*$/;
    var valid = (value == undefined) ? true : INTEGER_REGEXP.test(value);

    if (errorHolder != undefined) toggleErrorMessageDisplay(valid, errorHolder);

    return valid;
};

function parseIntWithBaseTen(number) {
  return parseInt(number, 10);
}

<commit_msg>|#0|   Balvinder|Fixing rnr form to preserve previous value when entering incorrect value<commit_after>var rnrModule = angular.module('rnr', ['openlmis', 'ngGrid']).config(['$routeProvider', function ($routeProvider) {
    $routeProvider.
        when('/init-rnr', {controller:InitiateRnrController, templateUrl:'partials/init.html'}).
        when('/create-rnr/:facility/:program/:period', {controller: RequisitionController, templateUrl:'partials/create.html'}).
        when('/rnr-for-approval', {controller: ApproveRnrListController, templateUrl:'partials/list.html', resolve: ApproveRnrListController.resolve}).
        when('/requisitions-for-convert-to-order', {controller: ConvertToOrderListController, templateUrl:'partials/convert-to-order-list.html', resolve: ConvertToOrderListController.resolve}).
        when('/rnr-for-approval/:rnr/:facility/:program', {controller:ApproveRnrController, templateUrl:'partials/approve.html', resolve: ApproveRnrController.resolve}).
        otherwise({redirectTo:'/init-rnr'});
}]).directive('rnrValidator', function () {
        return {
            require:'?ngModel',
            link:function (scope, element, attrs, ctrl) {
                var validationFunction = rnrModule[attrs.rnrValidator];
                ctrl.$parsers.unshift(function (viewValue) {
                    if (validationFunction(viewValue, element.attr('name'))) {
                        ctrl.$setValidity(element.attr('name'), true);
                        ctrl.$setValidity('rnrError', true);
                        if (viewValue == "") viewValue = undefined;
                        return viewValue;
                    } else {
                        ctrl.$setValidity(element.attr('name'), false);
                        if(!attrs['preventRnrError']) ctrl.$setValidity('rnrError', false);
                        return viewValue;
                    }
                });
            }
        };
    });

rnrModule.positiveInteger = function (value, errorHolder) {
    var toggleErrorMessageDisplay = function (valid, errorHolder) {
        if (valid) {
            document.getElementById(errorHolder).style.display = 'none';
        } else {
            document.getElementById(errorHolder).style.display = 'block';
        }
    };

    var INTEGER_REGEXP = /^\d*$/;
    var valid = (value == undefined) ? true : INTEGER_REGEXP.test(value);

    if (errorHolder != undefined) toggleErrorMessageDisplay(valid, errorHolder);

    return valid;
};

function parseIntWithBaseTen(number) {
  return parseInt(number, 10);
}


{'fraction_non_alphanumeric': 0.13685045616818722, 'fraction_numerical': 0.0009916699722332407, 'mean_word_length': 2.68640350877193, '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': '4556838', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1321, 'n_words': 221}