<commit_before>module CategoriesHelper
	def get_initial_categories(item)	
		categories_selection_array = []
		item.holder_categories.map { |category| categories_selection_array << category.id }
		categories_selection_array
	end

	def recursive_tree(root, html)
		html << ''
		if root.children.blank?
		  html << "<li category_id="+root.id.to_s+">#{root.title}</li>"
		  return html.html_safe
		else
		  html << "<li item-expanded='true' category_id="+root.id.to_s+">#{root.title}" # Explanation 2
		  for template_child in root.children
		    temp_html = '' # Explanation 1
		    html << "<ul>#{recursive_tree(template_child, temp_html)}</ul>"
		  end
		  html << "</li>"
		end
		return html.html_safe
		end

	def category_thumbnail(category)
		thumbs_array = []
		category.property_objects.each do |item|
			if item.object.class == Picture
				thumbs_array << item.object.file.to_s+"?style=500"
			elsif item.object.class == Excursion
				thumbs_array << excursion_raw_thumbail(item.object)
			elsif item.object.class == Event && !item.object.poster.file_file_name.nil?
				thumbs_array << item.object.poster.file.to_s
			end
		end
		
		result = "<div class='category_thumb'>"
		for i in 0..3
			if thumbs_array[i]
				result += "<div class='category_thumb_"+i.to_s+"'><img src='"+thumbs_array[i]+"'/></div>"
			else
				result += "<div class='category_thumb_"+i.to_s+"'></div>"
			end
		end			
		result += "</div>"
		return raw result
	end
end<commit_msg>Bug fixed on categories tree<commit_after>module CategoriesHelper
	def get_initial_categories(item)	
		categories_selection_array = []
		item.holder_categories.map { |category| categories_selection_array << category.id }
		categories_selection_array
	end

	def recursive_tree(root, html="")
		children = root.children
		if children.blank?
		  html << "<li category_id="+root.id.to_s+">#{root.title}</li>"
		  return html.html_safe
		else
		  html << "<li item-expanded='true' category_id="+root.id.to_s+">#{root.title}"
		  html << "<ul>"
			for child in children
				html << recursive_tree(child)
			end
		  html << "</ul>"
		  html << "</li>"
		end

		return html.html_safe
	end

	def category_thumbnail(category)
		thumbs_array = []
		category.property_objects.each do |item|
			if item.object.class == Picture
				thumbs_array << item.object.file.to_s+"?style=500"
			elsif item.object.class == Excursion
				thumbs_array << excursion_raw_thumbail(item.object)
			elsif item.object.class == Event && !item.object.poster.file_file_name.nil?
				thumbs_array << item.object.poster.file.to_s
			end
		end
		
		result = "<div class='category_thumb'>"
		for i in 0..3
			if thumbs_array[i]
				result += "<div class='category_thumb_"+i.to_s+"'><img src='"+thumbs_array[i]+"'/></div>"
			else
				result += "<div class='category_thumb_"+i.to_s+"'></div>"
			end
		end			
		result += "</div>"
		return raw result
	end
end
{'fraction_non_alphanumeric': 0.14678260869565218, 'fraction_numerical': 0.0041739130434782605, 'mean_word_length': 3.907849829351536, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 29, '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': '3288032', 'n_tokens_mistral': 1143, 'n_tokens_neox': 989, 'n_words': 194}