<commit_before>'use strict';
// Podcasts controller
angular.module('podcasts').controller('PodcastsController', ['$scope', 'fileUpload', '$stateParams', '$location', 'Authentication', 'Podcasts', '$sce',
	function($scope, fileUpload, $stateParams, $location, Authentication, Podcasts, $sce) {
		$scope.authentication = Authentication;
		$scope.searchText = '';
		$scope.currentPage = parseInt($stateParams.page, 10);
		if ($location.path() === '/podcasts/browse/')
		{
			$scope.currentPage = 1;
		}
		$scope.perPage = 10;
		// Create new Podcast
		$scope.create = function() {
			// Create new Podcast object
			var podcast = new Podcasts ({
				name: this.name,
				blog: this.blog,
				blurb: this.blurb,
				audio: this.audio,
				audioOriginal: this.audioOriginal,
				category: this.category
			});
			if (typeof $scope.myFile !== 'undefined') {
				var file = $scope.myFile;
				var name = file.name;
				var ext = name.substring(name.lastIndexOf('.'), name.length);
				if (ext === '.mp3' || ext === '.ogg' || ext === '.wav')
				{
					var d = Date.now();
					var uploadUrl = '/uploads/audio/' + d;
					podcast.audioOriginal = name;
					podcast.audio = name.replace(ext, d + ext);
					fileUpload.uploadFileToUrl(file, uploadUrl);
				}
			}
			// Redirect after save
			podcast.$save(function(response) {
				$location.path('podcasts/' + response._id);

				// Clear form fields
				$scope.name = '';
				$scope.blog = '';
				$scope.blurb = '';
				$scope.audio = '';
				$scope.audioOriginal = '';
				$scope.category = '';
			}, function(errorResponse) {
				$scope.error = errorResponse.data.message;
			});
		};

		// Remove existing Podcast
		$scope.remove = function(podcast) {
			var r = confirm("Are you sure you want to delete this podcast? Deletion is permanent.");
			if ( r == true ) {
				if ( podcast ) { 
					podcast.$remove();

					for (var i in $scope.podcasts) {
						if ($scope.podcasts [i] === podcast) {
							$scope.podcasts.splice(i, 1);
						}
					}
				} else {
					$scope.podcast.$remove(function() {
						$location.path('podcasts');
					});
				}
			} else {
				//not removed
			}
		};
<commit_msg>fix errors<commit_after>'use strict';
// Podcasts controller
angular.module('podcasts').controller('PodcastsController', ['$scope', 'fileUpload', '$stateParams', '$location', 'Authentication', 'Podcasts', '$sce',
	function($scope, fileUpload, $stateParams, $location, Authentication, Podcasts, $sce) {
		$scope.authentication = Authentication;
		$scope.searchText = '';
		$scope.currentPage = parseInt($stateParams.page, 10);
		if ($location.path() === '/podcasts/browse/')
		{
			$scope.currentPage = 1;
		}
		$scope.perPage = 10;
		// Create new Podcast
		$scope.create = function() {
			// Create new Podcast object
			var podcast = new Podcasts ({
				name: this.name,
				blog: this.blog,
				blurb: this.blurb,
				audio: this.audio,
				audioOriginal: this.audioOriginal,
				category: this.category
			});
			if (typeof $scope.myFile !== 'undefined') {
				var file = $scope.myFile;
				var name = file.name;
				var ext = name.substring(name.lastIndexOf('.'), name.length);
				if (ext === '.mp3' || ext === '.ogg' || ext === '.wav')
				{
					var d = Date.now();
					var uploadUrl = '/uploads/audio/' + d;
					podcast.audioOriginal = name;
					podcast.audio = name.replace(ext, d + ext);
					fileUpload.uploadFileToUrl(file, uploadUrl);
				}
			}
			// Redirect after save
			podcast.$save(function(response) {
				$location.path('podcasts/' + response._id);

				// Clear form fields
				$scope.name = '';
				$scope.blog = '';
				$scope.blurb = '';
				$scope.audio = '';
				$scope.audioOriginal = '';
				$scope.category = '';
			}, function(errorResponse) {
				$scope.error = errorResponse.data.message;
			});
		};

		// Remove existing Podcast
		$scope.remove = function(podcast) {
			var r = confirm('Are you sure you want to delete this podcast? Deletion is permanent.');
			if ( r === true ) {
				if ( podcast ) { 
					podcast.$remove();

					for (var i in $scope.podcasts) {
						if ($scope.podcasts [i] === podcast) {
							$scope.podcasts.splice(i, 1);
						}
					}
				} else {
					$scope.podcast.$remove(function() {
						$location.path('podcasts');
					});
				}
			}
		};

{'fraction_non_alphanumeric': 0.17369901547116737, 'fraction_numerical': 0.0032817627754336614, 'mean_word_length': 2.865036231884058, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3315569', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1374, 'n_words': 304}