<commit_before>/// <reference path="../../typings/angular/angular1.d.ts" />
(function() {
	'use strict';
	var config = window.config;
	var initial = config.initial;
	var presets = config.presets;
	var options = config.options;
	
	var app = angular.module('app', []);
	
	app.controller('OrderController', ['$scope', function($scope) {
		// options
		$scope.options = options;		
		$scope.steps = config.steps;
		$scope.stepNames = config.stepNames;
		
		// setup initial model values
		$scope.step = initial.step;
		$scope.crust = initial.crust;
		$scope.size = initial.size;
		$scope.preset = initial.preset;
		$scope.sauce = initial.sauce;
		$scope.cheese = initial.cheese;
		$scope.toppings = [];
		
		// computed values
		$scope.isCustom = function() {
			return $scope.preset === initial.preset;
		};
		$scope.hasTopping = function(topping) {
			return $scope.toppings.indexOf(topping) !== -1;
		}
		$scope.nextText = function() {
			var isLastStep = $scope.stepNames.length - 1 == $scope.step;
			return isLastStep ? 'Restart' : 'Next';
		}
		
		// events
		$scope.toggleTopping = function(topping) {
			// get index of topping
			var indexOfTopping = $scope.toppings.indexOf(topping);
			if (indexOfTopping === -1) {
				// add topping if not exist
				$scope.toppings.push(topping);
				return;
			}
			
			// remove topping
			$scope.toppings.splice(indexOfTopping, 1);
		};
		$scope.prev = function()  {
			var newStep = $scope.step - 1;
			if (newStep < 0) {
				newStep = 0;
			}
			$scope.step = newStep;
		};
		$scope.next = function() {
			var newStep = $scope.step + 1
			if (newStep >= $scope.stepNames.length) {
				window.location.reload();
			}
			$scope.step = newStep;
		};
		$scope.submit = function() {
			console.log($scope);
		};
		// watch the preset
		$scope.$watch('preset', function (newValue, oldValue) {
			if (newValue === oldValue) {
				// skip updates when the preset hasn't changed<commit_msg>removed submit method from angularjs1 project<commit_after>/// <reference path="../../typings/angular/angular1.d.ts" />
(function() {
	'use strict';
	var config = window.config;
	var initial = config.initial;
	var presets = config.presets;
	var options = config.options;
	
	var app = angular.module('app', []);
	
	app.controller('OrderController', ['$scope', function($scope) {
		// options
		$scope.options = options;		
		$scope.steps = config.steps;
		$scope.stepNames = config.stepNames;
		
		// setup initial model values
		$scope.step = initial.step;
		$scope.crust = initial.crust;
		$scope.size = initial.size;
		$scope.preset = initial.preset;
		$scope.sauce = initial.sauce;
		$scope.cheese = initial.cheese;
		$scope.toppings = [];
		
		// computed values
		$scope.isCustom = function() {
			return $scope.preset === initial.preset;
		};
		$scope.hasTopping = function(topping) {
			return $scope.toppings.indexOf(topping) !== -1;
		}
		$scope.nextText = function() {
			var isLastStep = $scope.stepNames.length - 1 == $scope.step;
			return isLastStep ? 'Restart' : 'Next';
		}
		
		// events
		$scope.toggleTopping = function(topping) {
			// get index of topping
			var indexOfTopping = $scope.toppings.indexOf(topping);
			if (indexOfTopping === -1) {
				// add topping if not exist
				$scope.toppings.push(topping);
				return;
			}
			
			// remove topping
			$scope.toppings.splice(indexOfTopping, 1);
		};
		$scope.prev = function()  {
			var newStep = $scope.step - 1;
			if (newStep < 0) {
				newStep = 0;
			}
			$scope.step = newStep;
		};
		$scope.next = function() {
			var newStep = $scope.step + 1
			if (newStep >= $scope.stepNames.length) {
				window.location.reload();
			}
			$scope.step = newStep;
		};
		// watch the preset
		$scope.$watch('preset', function (newValue, oldValue) {
			if (newValue === oldValue) {
				// skip updates when the preset hasn't changed
{'fraction_non_alphanumeric': 0.1590909090909091, 'fraction_numerical': 0.004963427377220481, 'mean_word_length': 3.051851851851852, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3686847', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1305, 'n_words': 281}