<commit_before>package dad.endlessElectronicMusic.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import dad.endlessElectronicMusic.entidades.Cancion;
import dad.endlessElectronicMusic.entidades.CancionRepository;
import dad.endlessElectronicMusic.entidades.UsuarioRepository;

@Controller
public class ControllerSongsCategory {

	@Autowired
	private CancionRepository cancionRepository;
	@Autowired
	private UsuarioRepository usuarioRepository;

	private String sLogin = "Iniciar Sesión";
	private String sRegister = "Registrarse";
	private String sPathRegister = "user-register.html";
	private String sPathLogin = "#";
	private String toModal = "#login-modal";
	private String modal = "modal";

	@RequestMapping("/songs-category")
	public ModelAndView printSongCategory(HttpServletRequest request, HttpSession sesion, @RequestParam String filter) {
		ModelAndView result = new ModelAndView();
		result.addObject("resources", request.getContextPath() + "/resources");

		ControllerIndex.loginString(sLogin, sRegister, sPathRegister, sPathLogin, toModal, modal, result, sesion,
				usuarioRepository);
		List<Cancion> canciones;
		if(filter.equals("valoracion")){
			canciones=cancionRepository.findAll(new Sort(new Order(Sort.Direction.ASC, "valoracion")));
		}
		else{
		 canciones = cancionRepository.findAll(new Sort(filter));
		}
		result.addObject("cancion", canciones);

		result.addObject("total", canciones.size());

		return result;

	}
	
	

}<commit_msg>Ordenacion por valoracion y por año de forma descendiente<commit_after>package dad.endlessElectronicMusic.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import dad.endlessElectronicMusic.entidades.Cancion;
import dad.endlessElectronicMusic.entidades.CancionRepository;
import dad.endlessElectronicMusic.entidades.UsuarioRepository;

@Controller
public class ControllerSongsCategory {

	@Autowired
	private CancionRepository cancionRepository;
	@Autowired
	private UsuarioRepository usuarioRepository;

	private String sLogin = "Iniciar Sesión";
	private String sRegister = "Registrarse";
	private String sPathRegister = "user-register.html";
	private String sPathLogin = "#";
	private String toModal = "#login-modal";
	private String modal = "modal";

	@RequestMapping("/songs-category")
	public ModelAndView printSongCategory(HttpServletRequest request, HttpSession sesion, @RequestParam String filter) {
		ModelAndView result = new ModelAndView();
		result.addObject("resources", request.getContextPath() + "/resources");

		ControllerIndex.loginString(sLogin, sRegister, sPathRegister, sPathLogin, toModal, modal, result, sesion,
				usuarioRepository);
		List<Cancion> canciones;
		if(filter.equals("valoracion") || filter.equals("anio")){
			canciones=cancionRepository.findAll(new Sort(new Order(Sort.Direction.DESC, filter)));
		}
		else{
		 canciones = cancionRepository.findAll(new Sort(filter));
		}
		result.addObject("cancion", canciones);

		result.addObject("total", canciones.size());

		return result;

	}
	
	

}
{'fraction_non_alphanumeric': 0.10373975409836066, 'fraction_numerical': 0.0, 'mean_word_length': 6.597276264591439, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5633511', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1126, 'n_words': 223}