<commit_before>/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * Written by Relevance UI Team,
 * Aug 2015
 */

(function(angular){
	"use strict";
	angular.module('workzone.orchestration')
		.controller('addChefJobEventCtrl',['$scope', '$modalInstance', 'items' ,'toastr',function($scope, $modalInstance , items , toastr){
			console.log(items);
			$scope.defaultSelection = function() {
				$scope.repeatsType = 'Minutes';//default selection.
				$scope.schedulerStartOn=moment(new Date()).format('MM/DD/YYYY');
            	$scope.schedulerEndOn=moment(new Date()).format('MM/DD/YYYY');	
			};
			if(items.type !== 'new'){
				if(items.chefJenkScriptTaskObj !==undefined){
					if(items.chefJenkScriptTaskObj.cronStartOn && items.chefJenkScriptTaskObj.cronEndOn) {
						var newStartOn = parseInt(items.chefJenkScriptTaskObj.cronStartOn);
						var newDate = new Date(newStartOn).toLocaleDateString();
						var datearray = newDate.split("/");
						var newdate = datearray[1] + '/' + datearray[0] + '/' + datearray[2];
						$scope.schedulerStartOn = newdate;
						var newEndOn = parseInt(items.chefJenkScriptTaskObj.cronEndOn);
						var newEndData = new Date(newEndOn).toLocaleDateString();	
						var datearrayNew = newEndData.split("/");
						var newdateEnd = datearrayNew[1] + '/' + datearrayNew[0] + '/' + datearrayNew[2];
						$scope.schedulerEndOn = newdateEnd;
					} else {
						$scope.schedulerStartOn = items.chefJenkScriptTaskObj.cronStart;
						$scope.schedulerEndOn = items.chefJenkScriptTaskObj.cronEnd;	
					}
				
					$scope.repeatBy = items.chefJenkScriptTaskObj.repeatBy || items.chefJenkScriptTaskObj.cronRepeatEvery.toString();
					$scope.repeatsType = items.chefJenkScriptTaskObj.repeats || items.chefJenkScriptTaskObj.cronFrequency;
					$scope.timeEventType = items.chefJenkScriptTaskObj.startTime;
					$scope.timeEventMinute = items.chefJenkScriptTaskObj.startTimeMinute;
					$scope.weekOfTheDay = items.chefJenkScriptTaskObj.dayOfWeek;
					$scope.currentDate = items.chefJenkScriptTaskObj.startDate;
					$scope.selectedDayOfTheMonth = items.chefJenkScriptTaskObj.selectedDayOfTheMonth;
					$scope.selectedMonth = items.chefJenkScriptTaskObj.monthOfYear;
				} else {
					$scope.defaultSelection();
				}
			} else {
				$scope.defaultSelection();
			}<commit_msg>Check for undefined and null<commit_after>/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * Written by Relevance UI Team,
 * Aug 2015
 */

(function(angular){
	"use strict";
	angular.module('workzone.orchestration')
		.controller('addChefJobEventCtrl',['$scope', '$modalInstance', 'items' ,'toastr',function($scope, $modalInstance , items , toastr){
			console.log(items);
			$scope.defaultSelection = function() {
				$scope.repeatsType = 'Minutes';//default selection.
				$scope.schedulerStartOn=moment(new Date()).format('MM/DD/YYYY');
            	$scope.schedulerEndOn=moment(new Date()).format('MM/DD/YYYY');	
			};
			if(items.type !== 'new'){
				if(items.chefJenkScriptTaskObj !=null){
					if(items.chefJenkScriptTaskObj.cronStartOn && items.chefJenkScriptTaskObj.cronEndOn) {
						var newStartOn = parseInt(items.chefJenkScriptTaskObj.cronStartOn);
						var newDate = new Date(newStartOn).toLocaleDateString();
						var datearray = newDate.split("/");
						var newdate = datearray[1] + '/' + datearray[0] + '/' + datearray[2];
						$scope.schedulerStartOn = newdate;
						var newEndOn = parseInt(items.chefJenkScriptTaskObj.cronEndOn);
						var newEndData = new Date(newEndOn).toLocaleDateString();	
						var datearrayNew = newEndData.split("/");
						var newdateEnd = datearrayNew[1] + '/' + datearrayNew[0] + '/' + datearrayNew[2];
						$scope.schedulerEndOn = newdateEnd;
					} else {
						$scope.schedulerStartOn = items.chefJenkScriptTaskObj.cronStart;
						$scope.schedulerEndOn = items.chefJenkScriptTaskObj.cronEnd;	
					}
				
					$scope.repeatBy = items.chefJenkScriptTaskObj.repeatBy || items.chefJenkScriptTaskObj.cronRepeatEvery.toString();
					$scope.repeatsType = items.chefJenkScriptTaskObj.repeats || items.chefJenkScriptTaskObj.cronFrequency;
					$scope.timeEventType = items.chefJenkScriptTaskObj.startTime;
					$scope.timeEventMinute = items.chefJenkScriptTaskObj.startTimeMinute;
					$scope.weekOfTheDay = items.chefJenkScriptTaskObj.dayOfWeek;
					$scope.currentDate = items.chefJenkScriptTaskObj.startDate;
					$scope.selectedDayOfTheMonth = items.chefJenkScriptTaskObj.selectedDayOfTheMonth;
					$scope.selectedMonth = items.chefJenkScriptTaskObj.monthOfYear;
				} else {
					$scope.defaultSelection();
				}
			} else {
				$scope.defaultSelection();
			}
{'fraction_non_alphanumeric': 0.12640852284367957, 'fraction_numerical': 0.004097520999795124, 'mean_word_length': 4.289274106175514, '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': '2502867', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1587, 'n_words': 242}