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

class Curso_model extends CI_Model
{

    function __construct()
    {
        parent:: __construct();
        $this->load->database();
    }


    function obtener($id)
    {
        $this->db->where('idCurso', $id);
        $query = $this->db->get('curso');
        if ($query->num_rows() > 0) return $query->result()[0];
        else return false;
    }
    function obtenerPadre($id)
    {
        $this->db->where('idCurso', $id);
        $query = $this->db->query("SELECT cp.*, ch.grupo from curso as cp inner join cursohijo as ch on cp.idCurso = ch.idCurso where idCursoHijo = $id;");
        if ($query->num_rows() > 0) return $query->result()[0];
        else return false;
    }

    function obtenerCursos(){
        $query = $this->db->get('curso');
        if($query->num_rows() > 0) return $query;
        else return false;
    }

    function obtenerLista($carrera,$id){
        $query = "select ch.* from cursohijo as ch inner join curso as c
        on ch.idCurso = c.idCurso inner join cursoporcarrera as cc on c.idCurso = cc.idCurso inner join carrera as ca
        on cc.idCarrera = ca.idCarrera where ca.idCarrera = '$carrera' and ch.estado = '1' and c.idCurso not in (select distinct c.idCurso
        from curso as c inner join cursohijo as ch on c.idCurso = ch.idCurso inner join estudianteporcurso as ec
        on ch.idCursoHijo = ec.idCursoHijo inner join estuduante as e on ec.idEstudiante = e.idEstudiante
        where e.idEstudiante = '$id' and ec.NotaFinal <=> null or ec.NotaFinal >= '70') and c.idCurso not in(
        select distinct c.idCurso from curso as c inner join cursohijo as ch on c.idCurso = ch.idCurso
        inner join estudianteporcurso as ec on ch.idCursoHijo = ec.idCursoHijo inner join estuduante as e
        on ec.idEstudiante = e.idEstudiante inner join estudianteporcarrera as ecar on e.idEstudiante = ecar.idEstudiante
        where e.idEstudiante = '$id' and ec.NotaFinal  >= '70') and c.idCurso not in(select c.idCurso from curso as c inner join cursoporcarrera as cc
        on c.idCurso = cc.idCurso inner join dependencia as d on cc.idCursoPorCarrera = d.idCursoPorCarrera)
        or c.idCurso in (select c.idCurso from cursohijo as ch inner join curso as c on ch.idCurso = c.idCurso inner join cursoporcarrera as cc
        on c.idCurso = cc.idCurso inner join dependencia as d on cc.idCursoPorCarrera = d.idCursoPorCarrera
        where cc.idCarrera = '$carrera' and d.dependencia in(select distinct c.idCurso from curso as c inner join cursohijo as ch
        on c.idCurso = ch.idCurso inner join estudianteporcurso as ec on ch.idCursoHijo = ec.idCursoHijo
        inner join estuduante as e on ec.idEstudiante = e.idEstudiante where ec.NotaFinal >= '70' and e.idEstudiante = '$id')and
        c.idCurso not in(select c.idCurso from curso as c inner join cursohijo as ch on c.idCurso = ch.idCurso
        inner join estudianteporcurso as ec on ch.idCurso = ec.idCursoHijo));";
        return $this->db->query($query);
    }


}
?><commit_msg>Consulta creo q terminada<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Curso_model extends CI_Model
{

    function __construct()
    {
        parent:: __construct();
        $this->load->database();
    }


    function obtener($id)
    {
        $this->db->where('idCurso', $id);
        $query = $this->db->get('curso');
        if ($query->num_rows() > 0) return $query->result()[0];
        else return false;
    }
    function obtenerPadre($id)
    {
        $this->db->where('idCurso', $id);
        $query = $this->db->query("SELECT cp.*, ch.grupo from curso as cp inner join cursohijo as ch on cp.idCurso = ch.idCurso where idCursoHijo = $id;");
        if ($query->num_rows() > 0) return $query->result()[0];
        else return false;
    }

    function obtenerCursos(){
        $query = $this->db->get('curso');
        if($query->num_rows() > 0) return $query;
        else return false;
    }

    function obtenerLista($carrera,$id){
        $query = "select ch.* from cursohijo as ch inner join curso as c
        on ch.idCurso = c.idCurso inner join cursoporcarrera as cc on c.idCurso = cc.idCurso inner join carrera as ca
        on cc.idCarrera = ca.idCarrera where ca.idCarrera = '$carrera' and ch.estado = '1' and c.idCurso not in (select distinct c.idCurso
        from curso as c inner join cursohijo as ch on c.idCurso = ch.idCurso inner join estudianteporcurso as ec
        on ch.idCursoHijo = ec.idCursoHijo inner join estuduante as e on ec.idEstudiante = e.idEstudiante
        where e.idEstudiante = '$id' and ec.NotaFinal <=> null or ec.NotaFinal >= '70') and c.idCurso not in(
        select distinct c.idCurso from curso as c inner join cursohijo as ch on c.idCurso = ch.idCurso
        inner join estudianteporcurso as ec on ch.idCursoHijo = ec.idCursoHijo inner join estuduante as e
        on ec.idEstudiante = e.idEstudiante inner join estudianteporcarrera as ecar on e.idEstudiante = ecar.idEstudiante
        where e.idEstudiante = '$id' and ec.NotaFinal  >= '70') and c.idCurso not in(select c.idCurso from curso as c inner join cursoporcarrera as cc
        on c.idCurso = cc.idCurso inner join dependencia as d on cc.idCursoPorCarrera = d.idCursoPorCarrera)
        or c.idCurso in (select c.idCurso from cursohijo as ch inner join curso as c on ch.idCurso = c.idCurso inner join cursoporcarrera as cc
        on c.idCurso = cc.idCurso inner join dependencia as d on cc.idCursoPorCarrera = d.idCursoPorCarrera
        where cc.idCarrera = '$carrera' and d.dependencia in(select distinct c.idCurso from curso as c inner join cursohijo as ch
        on c.idCurso = ch.idCurso inner join estudianteporcurso as ec on ch.idCursoHijo = ec.idCursoHijo
        inner join estuduante as e on ec.idEstudiante = e.idEstudiante where ec.NotaFinal >= '70' and e.idEstudiante = '$id')and
        c.idCurso not in(select c.idCurso from curso as c inner join cursohijo as ch on c.idCurso = ch.idCurso
        inner join estudianteporcurso as ec on ch.idCurso = ec.idCursoHijo where ec.NotaFinal <=> null or ec.NotaFinal >= 70));";
        return $this->db->query($query);
    }


}
?>
{'fraction_non_alphanumeric': 0.10348688419705694, 'fraction_numerical': 0.004158669225847729, 'mean_word_length': 2.957594936708861, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 59, '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': '3609304', 'n_tokens_mistral': 2187, 'n_tokens_neox': 2140, 'n_words': 671}