Skip to content

Commit

Permalink
fix: Correccion errores Sonarqube udistrital/polux_cliente#791
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanDHernandezA committed Oct 25, 2024
1 parent 50aea3b commit 4281776
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 80 deletions.
11 changes: 1 addition & 10 deletions controllers/verificarRequisitos.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ func stringInSlice(str string, list []string) bool {
return false
}

func stringInSlice2(str string, list []string) bool {
for _, v := range list {
if v == str {
return true
}
}
return false
}

// CantidadModalidades ...
// @Title CantidadModalidades
// @Description Validar si la cantidad de estudiantes solicitados es menor o igual a la cantidad de estudiantes que permite la modalidad
Expand Down Expand Up @@ -141,7 +132,7 @@ func (c *VerificarRequisitosController) Registrar() {

estados := []string{"A", "B", "V", "T", "J"}
modalidades := []string{"MONO_PLX", "INV_PLX", "PEMP_PLX", "PACAD_PLX", "PAS_PLX"} //Modalidades que solo necesitan el Porcentaje cursado y el Estado del estudiante
if stringInSlice2(v.Estado, estados) {
if stringInSlice(v.Estado, estados) {
estado = "activo"
}
reglasbase = reglasBase + "estado(" + codigo + ", " + estado + ").cursado(" + codigo + ", " + porcentaje + ").nivel(" + codigo + ", " + nivel + ")."
Expand Down
8 changes: 4 additions & 4 deletions golog/golog_comprobacion.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
)

// Comprobar ...
func Comprobar(reglas string, regla_inyectada string) (rest string) {
func Comprobar(reglas string, reglaInyectada string) (rest string) {

//******QUITAR ARREGLO, DEJAR UNA SOLA VARIABLE PARA LAS REGLAS ******
m := golog.NewMachine().Consult(reglas)
if m.CanProve(regla_inyectada) {
if m.CanProve(reglaInyectada) {
rest = "true"
} else {
rest = "false"
Expand All @@ -22,12 +22,12 @@ func Comprobar(reglas string, regla_inyectada string) (rest string) {
}

// Obtener ...
func Obtener(reglas string, regla_inyectada string) (rest string) {
func Obtener(reglas string, reglaInyectada string) (rest string) {

var res string
m := golog.NewMachine().Consult(reglas)

resultados := m.ProveAll(regla_inyectada)
resultados := m.ProveAll(reglaInyectada)
for _, solution := range resultados {
res = fmt.Sprintf("%s", solution.ByName_("Y"))
}
Expand Down
Loading

0 comments on commit 4281776

Please sign in to comment.