<commit_before>﻿angular.module('TeaCommerce').controller('DiscountCodeRuleController', function ($scope, $http) {
  $scope.editMode = false;

  $scope.resetManual = function () {
    $scope.manualSettings = { codes: '', maxUses: 1 };
  };

  $scope.resetGenerate = function () {
    $scope.generateSettings = { numberToGenerate: 1000, maxUses: 1, length: 6, prefix: '', postfix: '' };
  };

  $scope.getNumber = function (number) {
    if (number == '') {
      number = 0;
    }
    return new Array(parseInt(number));
  };

  $scope.view = 'manual';
  $http.get('/umbraco/backoffice/teacommerce/discountcodes/getcount/?storeId=' + $scope.campaign.storeId + '&ruleId=' + $scope.rule.id).success(function (data) {
    $scope.numberOfDiscountCodes = data.total;
    $scope.numberOfUnusedDiscountCodes = data.unused;
  });

  $scope.resetManual();
  $scope.resetGenerate();

  $scope.manual = function () {
    $http.post('/umbraco/backoffice/teacommerce/discountcodes/add', {
      ruleId: $scope.rule.id,
      maxUses: $scope.manualSettings.maxUses,
      codes: $scope.manualSettings.codes
    }).success(function (data) {
      $scope.numberOfDiscountCodes += data.length;
      $scope.numberOfUnusedDiscountCodes += data.length;
    });

    $scope.resetManual();
    $scope.editMode = false;
  };

  $scope.generate = function () {
    $http.post('/umbraco/backoffice/teacommerce/discountcodes/generate', {
      storeId: $scope.campaign.storeId,
      ruleId: $scope.rule.id,
      numberToGenerate: $scope.generateSettings.numberToGenerate,
      maxUses: $scope.generateSettings.maxUses,
      length: $scope.generateSettings.length,
      prefix: $scope.generateSettings.prefix,
      postfix: $scope.generateSettings.postfix
    }).success(function (data) {
      $scope.numberOfDiscountCodes += data.length;
      $scope.numberOfUnusedDiscountCodes += data.length;
    });

    $scope.resetGenerate();
    $scope.editMode = false;
  };

  $scope.download = function () {
    window.open('/umbraco/backoffice/teacommerce/discountcodes/getdownload/?storeId=' + $scope.campaign.storeId + '&campaignId=' + $scope.campaign.id + '&ruleId=' + $scope.rule.id, '_blank', '');
  };
});<commit_msg>Changed discount code generate settings. NumberToGenerate from 1000 to 1.<commit_after>﻿angular.module('TeaCommerce').controller('DiscountCodeRuleController', function ($scope, $http) {
  $scope.editMode = false;

  $scope.resetManual = function () {
    $scope.manualSettings = { codes: '', maxUses: 1 };
  };

  $scope.resetGenerate = function () {
    $scope.generateSettings = { numberToGenerate: 1, maxUses: 1, length: 6, prefix: '', postfix: '' };
  };

  $scope.getNumber = function (number) {
    if (number == '') {
      number = 0;
    }
    return new Array(parseInt(number));
  };

  $scope.view = 'manual';
  $http.get('/umbraco/backoffice/teacommerce/discountcodes/getcount/?storeId=' + $scope.campaign.storeId + '&ruleId=' + $scope.rule.id).success(function (data) {
    $scope.numberOfDiscountCodes = data.total;
    $scope.numberOfUnusedDiscountCodes = data.unused;
  });

  $scope.resetManual();
  $scope.resetGenerate();

  $scope.manual = function () {
    $http.post('/umbraco/backoffice/teacommerce/discountcodes/add', {
      ruleId: $scope.rule.id,
      maxUses: $scope.manualSettings.maxUses,
      codes: $scope.manualSettings.codes
    }).success(function (data) {
      $scope.numberOfDiscountCodes += data.length;
      $scope.numberOfUnusedDiscountCodes += data.length;
    });

    $scope.resetManual();
    $scope.editMode = false;
  };

  $scope.generate = function () {
    $http.post('/umbraco/backoffice/teacommerce/discountcodes/generate', {
      storeId: $scope.campaign.storeId,
      ruleId: $scope.rule.id,
      numberToGenerate: $scope.generateSettings.numberToGenerate,
      maxUses: $scope.generateSettings.maxUses,
      length: $scope.generateSettings.length,
      prefix: $scope.generateSettings.prefix,
      postfix: $scope.generateSettings.postfix
    }).success(function (data) {
      $scope.numberOfDiscountCodes += data.length;
      $scope.numberOfUnusedDiscountCodes += data.length;
    });

    $scope.resetGenerate();
    $scope.editMode = false;
  };

  $scope.download = function () {
    window.open('/umbraco/backoffice/teacommerce/discountcodes/getdownload/?storeId=' + $scope.campaign.storeId + '&campaignId=' + $scope.campaign.id + '&ruleId=' + $scope.rule.id, '_blank', '');
  };
});
{'fraction_non_alphanumeric': 0.16079047832921625, 'fraction_numerical': 0.004042218728946777, 'mean_word_length': 3.7687366167023555, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7665972', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1444, 'n_words': 207}