Fix Error PreRequisitos evaluación #7196
Open
+49
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problemática:
Un usuario entra en un ejercicio de evaluación, responde bien y aprueba.
El mismo usuario, sin finalizar el curso, repite el ejercicio y en esta ocasión suspende.
El curso no deja avanzar ya que no está tomando en cuenta el ejercicio aprobado.
El problema está en el método parse_prereq() de learnpathItem.class.php
Línea 2349-2350: Se establece $returnstatus inicial
$status = $itemToCheck->get_status(true);
$returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3];
¿De dónde viene $status?
En este caso:
Usuario hace intento 1 -> 100% -> c_lp_item_view.status = 'completed'
Usuario hace intento 2 -> 0% → c_lp_item_view.status = 'failed' (se sobrescribe)
get_status() devuelve 'failed'
$returnstatus = false ❌ (incorrecto)
Al estar a false, el método no consulta los resultados para comprobar cual es el mejor resultado, no dejando avanzar.
Esto ocurre en la línea 2370 donde tenemos este if
// 2. If is completed we check the results in the DB of the quiz.
if ($returnstatus) { ... }
Eliminado ese if se resolvería el problema