<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Student extends Person {

	public $con;

	public function __construct()
	{
		parent::__construct();
		
	}

	function exists($student_id)
	{
		$this->db->from('estudiante');
		$this->db->join('persona', 'estudiante.cedula = persona.cedula');
		$this->db->where('estudiante.cedula',$student_id);
		$query = $this->db->get();

		return ($query->num_rows()==1);
	}

	function get_all_info(){
		$this->db->from('estudiante');
		$this->db->join('persona', 'persona.cedula = estudiante.cedula');
		return $this->db->get();
	}

	function get_info($student_id)
	{
		$this->db->from('estudiante');
		$this->db->join('persona', 'persona.cedula = estudiante.cedula');
		$this->db->where('estudiante.cedula',$student_id);
		$query = $this->db->get();

		if($query->num_rows()==1)
		{
			return $query->row();
		}
		else
		{
			//Get empty base parent object, as $student_id is NOT an employee
			$person_obj=parent::get_info(-1);

			//Get all the fields from employee table
			$fields = $this->db->list_fields('estudiante');

			//append those fields to base parent object, we we have a complete empty object
			foreach ($fields as $field)
			{
				$person_obj->$field='';
			}

			return $person_obj;
		}
	}

	function get_student_requests($student_id){
		$this->db->from('solicitud');
		$this->db->join('estudiante', 'estudiante.matricula = solicitud.matricula');
		$this->db->where('estudiante.cedula',$student_id);
		return $this->db->get();
	}

	function search($cedula){
		$this->db->from('estudiante');
		$this->db->join('persona', 'estudiante.cedula = persona.cedula');
		$this->db->like("CONCAT(persona.cedula, ' ', persona.nombre, ' ', persona.apellido)", $cedula);
		$result = $this->db->get();

		if ($result->num_rows()>0) {
			return $result;
		}

		return FALSE;
	}

	function save(&$person_data, &$student_data,$student_id=0)
	{<commit_msg>Pequeños FIxes de optimizacion en consultas<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Student extends Person {

	public $con;

	public function __construct()
	{
		parent::__construct();
		
	}

	function exists($student_id)
	{
		$this->db->from('estudiante');
		$this->db->where('cedula',$student_id);
		$query = $this->db->get();

		return ($query->num_rows()==1);
	}

	function get_all_info(){
		$this->db->from('estudiante');
		$this->db->join('persona', 'persona.cedula = estudiante.cedula');
		return $this->db->get();
	}

	function get_info($student_id)
	{
		$this->db->from('estudiante');
		$this->db->join('persona', 'persona.cedula = estudiante.cedula');
		$this->db->where('estudiante.cedula',$student_id);
		$query = $this->db->get();

		if($query->num_rows()==1)
		{
			return $query->row();
		}
		else
		{
			//Get empty base parent object, as $student_id is NOT an employee
			$person_obj=parent::get_info(-1);

			//Get all the fields from employee table
			$fields = $this->db->list_fields('estudiante');

			//append those fields to base parent object, we we have a complete empty object
			foreach ($fields as $field)
			{
				$person_obj->$field='';
			}

			return $person_obj;
		}
	}

	function get_student_requests($student_id){
		$this->db->from('solicitud');
		$this->db->join('estudiante', 'estudiante.matricula = solicitud.matricula');
		$this->db->where('estudiante.cedula',$student_id);
		return $this->db->get();
	}

	function search($cedula, $filtro = false){
		$this->db->from('estudiante');
		$this->db->join('persona', 'estudiante.cedula = persona.cedula');
		if ($filtro) {
			$this->db->join('solicitud', 'estudiante.matricula = solicitud.matricula');
		}
		$this->db->like("CONCAT(persona.cedula, ' ', persona.nombre, ' ', persona.apellido)", $cedula);
		$result = $this->db->get();

		if ($result->num_rows()>0) {
			return $result;
		}

		return FALSE;
	}

	function save(&$person_data, &$student_data,$student_id=0)
	{
{'fraction_non_alphanumeric': 0.19974683544303798, 'fraction_numerical': 0.002531645569620253, 'mean_word_length': 4.404924760601915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 95, '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': '4014824', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1448, 'n_words': 253}