<commit_before>function onLanguageSelected()
{
	controller(DIALOG_LANGUAGE).onLanguageSelected()
}

app.controller(CONTROLLER_OVERVIEW, function($scope, database, databaseToken, databaseLanguage, databaseSegment, ui)
{
	$scope.apiToken = ''

	$scope.languages = {}

	$scope.loading = true

	$scope.init = function()
	{
		databaseLanguage.ref().on('value', snapLanguages =>
		{	
			const languages = databaseLanguage.fromSnap(snapLanguages)

			databaseSegment.ref().once('value', snapSegments =>
			{
				const segments = databaseSegment.fromSnap(snapSegments)
				$scope.languages = summary(languages, segments)

				$scope.loading = false
				$scope.$applyAsync()

				databaseToken.ref().once('value', snap =>
				{
					$scope.apiToken = snap.val()
				})
			})
		})
	}

	function summary(languages, segments)
	{
		var result = []

		for (const segmentIndex in segments)
		{
			const segment = segments[segmentIndex]

			for (const languageIndex in segment.translations)
			{
				const translation = segment.translations[languageIndex]
				
				if (translation.value)
				{
					languages[languageIndex].translated++
				}

				if (translation.validated)
				{
					languages[languageIndex].validated++
				}
			}<commit_msg>Fixed bug deleting language<commit_after>function onLanguageSelected()
{
	controller(DIALOG_LANGUAGE).onLanguageSelected()
}

app.controller(CONTROLLER_OVERVIEW, function($scope, database, databaseToken, databaseLanguage, databaseSegment, ui)
{
	$scope.apiToken = ''

	$scope.languages = {}

	$scope.loading = true

	$scope.init = function()
	{
		databaseLanguage.ref().on('value', snapLanguages =>
		{	
			const languages = databaseLanguage.fromSnap(snapLanguages)

			databaseSegment.ref().once('value', snapSegments =>
			{
				const segments = databaseSegment.fromSnap(snapSegments)
				$scope.languages = summary(languages, segments)

				$scope.loading = false
				$scope.$applyAsync()

				databaseToken.ref().once('value', snap =>
				{
					$scope.apiToken = snap.val()
				})
			})
		})
	}

	function summary(languages, segments)
	{
		var result = []

		for (const segmentIndex in segments)
		{
			const segment = segments[segmentIndex]

			for (const languageIndex in segment.translations)
			{
				if (languages[languageIndex])
				{
					const translation = segment.translations[languageIndex]
					
					if (translation.value)
					{
						languages[languageIndex].translated++
					}

					if (translation.validated)
					{
						languages[languageIndex].validated++
					}
				}
			}
{'fraction_non_alphanumeric': 0.12341772151898735, 'fraction_numerical': 0.0, 'mean_word_length': 3.6488970588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4127198', 'n_tokens_mistral': 962, 'n_tokens_neox': 758, 'n_words': 131}