<commit_before>'use strict';

angular.module('payment').controller('OrderReviewController', ['$scope', '$http', '$location', '$stateParams', '$rootScope', function ($scope, $http, $location, $stateParams, $rootScope) {
    $scope.order = null;
    $scope.disabledConfirm = false;

    $http.get('/api/order/find/' + $stateParams.orderId).success(function (res) {
        if (res === null) {
            $location.path('/');
        } else {
            $scope.order = res;
        }
    });

    $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
        if (fromState.name === 'order-review') {
            $http.get('/api/order/cancel/' + $stateParams.orderId);
        }
    });

    $scope.confirmButton = function () {<commit_msg>fixed small error with order being canceled when going to complete<commit_after>'use strict';

angular.module('payment').controller('OrderReviewController', ['$scope', '$http', '$location', '$stateParams', '$rootScope', function ($scope, $http, $location, $stateParams, $rootScope) {
    $scope.order = null;
    $scope.disabledConfirm = false;

    $http.get('/api/order/find/' + $stateParams.orderId).success(function (res) {
        if (res === null) {
            $location.path('/');
        } else {
            $scope.order = res;
        }
    });

    $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
        if (fromState.name === 'order-review' && toState.name !== 'order-complete') {
            $http.get('/api/order/cancel/' + $stateParams.orderId);
        }
    });

    $scope.confirmButton = function () {
{'fraction_non_alphanumeric': 0.18462469733656175, 'fraction_numerical': 0.0, 'mean_word_length': 3.0814814814814815, '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': '5324317', 'n_tokens_mistral': 487, 'n_tokens_neox': 479, 'n_words': 96}