Exercice.class: fixed set_number
This commit is contained in:
parent
744a674f74
commit
3c4b6296ba
@ -74,14 +74,20 @@ class Exercice
|
||||
if ($this->require == "")
|
||||
$this->number = 1;
|
||||
|
||||
$exo = $this;
|
||||
$ret = 1;
|
||||
$db = new BDD();
|
||||
|
||||
$exo = $this->id;
|
||||
$ret = 0;
|
||||
|
||||
$checked = array();
|
||||
|
||||
do
|
||||
{
|
||||
$exo = new Exercice($exo->require);
|
||||
array_push($checked, $exo);
|
||||
$res = $db->unique_query("SELECT `require` FROM exercices WHERE id = ".intval($exo));
|
||||
$exo = $res['require'];
|
||||
$ret++;
|
||||
} while ($exo->require != "");
|
||||
} while ($exo != "" && !in_array($exo, $checked));
|
||||
|
||||
$this->number = $ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user