<commit_before>Ext.define('ActualCalculator', {
	extend: 'Rally.data.lookback.calculator.BaseCalculator',

	runCalculation: function(snapshots) {
		var completedIterationTotals = {};
		var completedStoryIterations = {};

		var incompleteIterationTotals = {};
		var oldTotal, iteration, iterationName;
		for(var s=0, l=snapshots.length; s < l; s++){
			var snapshot = snapshots[s];
			var objectID = snapshot.ObjectID;
			var iterations = this.getIterations(snapshot);
			if(iterations.length === 0){
				continue;
			}

			if(snapshot.ScheduleState === "Accepted"){
				iteration = iterations[0];
				iterationName = iteration.get('Name');
				if(snapshot._PreviousValues && (typeof snapshot._PreviousValues.ScheduleState) !== 'undefined' && !completedStoryIterations[objectID] ){
					completedStoryIterations[objectID] = iteration;
					oldTotal = completedIterationTotals[iterationName] || 0;
					completedIterationTotals[iterationName] = oldTotal + snapshot.PlanEstimate;
				}
			}
			else{
				for(var iter=0, iterL = iterations.length; iter < iterL; iter++){
					iteration = iterations[iter];
					iterationName = iteration.get('Name');
					oldTotal = incompleteIterationTotals[iterationName] || 0;
					incompleteIterationTotals[iterationName] = oldTotal + snapshot.PlanEstimate;
				}
			}

		}

		var actualSeriesData = [];
		var backlogRemainingSeriesData = [];
		var categories = [];
		for(var i=0, il=this.iterations.length; i < il; i++){
			iteration = this.iterations[i];
			iterationName = iteration.get('Name');
			var completedIterationTotal = completedIterationTotals[iterationName] || 0;
			actualSeriesData.push(completedIterationTotal);

			var incompleteIterationTotal = incompleteIterationTotals[iterationName] || 0;
			backlogRemainingSeriesData.push(incompleteIterationTotal);

			var endLabel = Rally.util.DateTime.formatWithDefault( iteration.get('EndDate') );
			var iterationLabel = iteration.get('Name') +'<br/>'+ endLabel;
			categories.push(iterationLabel);
		}
		return {
			series: [
				{
					name: 'Actual (Accepted Points per iteration)',
					data: actualSeriesData
				},
				{
					name: 'Backlog Remaining (Points per iteration)',
					data: backlogRemainingSeriesData
				}
			],
			categories: categories
		};
	},<commit_msg>Added Dev Increase.<commit_after>Ext.define('ActualCalculator', {
	extend: 'Rally.data.lookback.calculator.BaseCalculator',

	runCalculation: function(snapshots) {
		var completedIterationTotals = {};
		var completedStoryIterations = {};

		var incompleteIterationTotals = {};
		var oldTotal, iteration, iterationName;
		for(var s=0, l=snapshots.length; s < l; s++){
			var snapshot = snapshots[s];
			var objectID = snapshot.ObjectID;
			var iterations = this.getIterations(snapshot);
			if(iterations.length === 0){
				continue;
			}

			if(snapshot.ScheduleState === "Accepted"){
				iteration = iterations[0];
				iterationName = iteration.get('Name');
				if(snapshot._PreviousValues && (typeof snapshot._PreviousValues.ScheduleState) !== 'undefined' && !completedStoryIterations[objectID] ){
					completedStoryIterations[objectID] = iteration;
					oldTotal = completedIterationTotals[iterationName] || 0;
					completedIterationTotals[iterationName] = oldTotal + snapshot.PlanEstimate;
				}
			}
			else{
				for(var iter=0, iterL = iterations.length; iter < iterL; iter++){
					iteration = iterations[iter];
					iterationName = iteration.get('Name');
					oldTotal = incompleteIterationTotals[iterationName] || 0;
					incompleteIterationTotals[iterationName] = oldTotal + snapshot.PlanEstimate;
				}
			}

		}

		var actualSeriesData = [];
		var backlogRemainingSeriesData = [];
		var devIncreaseSeriesData = [];
		var devIncrease;
		var previousBacklogRemaining = null;
		var categories = [];
		for(var i=0, il=this.iterations.length; i < il; i++){
			iteration = this.iterations[i];
			iterationName = iteration.get('Name');
			var completedIterationTotal = completedIterationTotals[iterationName] || 0;
			actualSeriesData.push(completedIterationTotal);

			var backlogRemaining = incompleteIterationTotals[iterationName] || 0;
			backlogRemainingSeriesData.push(backlogRemaining);

			if(i === 0){
				devIncreaseSeriesData.push(0);
			}
			else{
				devIncrease = Math.min(backlogRemaining - previousBacklogRemaining + completedIterationTotal, 0);
				devIncreaseSeriesData.push(devIncrease);
				previousBacklogRemaining = backlogRemaining;
			}

			var endLabel = Rally.util.DateTime.formatWithDefault( iteration.get('EndDate') );
			var iterationLabel = iteration.get('Name') +'<br/>'+ endLabel;
			categories.push(iterationLabel);
		}
		return {
			series: [
				{
					name: 'Dev Incrase (Points per iteration)',
					data: devIncreaseSeriesData
				},
				{
					name: 'Actual (Accepted Points per iteration)',
					data: actualSeriesData
				},
				{
					name: 'Backlog Remaining (Points per iteration)',
					data: backlogRemainingSeriesData
				}
			],
			categories: categories
		};
	},
{'fraction_non_alphanumeric': 0.12244488977955911, 'fraction_numerical': 0.004208416833667334, 'mean_word_length': 4.32089552238806, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '466208', 'n_tokens_mistral': 1881, 'n_tokens_neox': 1494, 'n_words': 281}