1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-25 14:57:24 +02:00

Nombreuses petites corrections, ajout de texte.

Les Correspondances peuvent démarrer :)
This commit is contained in:
Yohann
2019-10-22 14:55:33 +02:00
parent 8adad9d5f7
commit 5c88ccb91a
32 changed files with 371 additions and 236 deletions

View File

@ -68,7 +68,7 @@ class Question
ensure($from->getProblem() == $to->getProblem(), "Les deux équipes doivent travailler sur le même problème.");
$req = $DB->prepare("SELECT * FROM `questions` WHERE `from` = ? AND `to` = ? ORDER BY `from`;");
$req = $DB->prepare("SELECT * FROM `questions` WHERE `from` = ? AND `to` = ? ORDER BY `from`, `number`;");
$req->execute([$from->getId(), $to->getId()]);
$questions = [];
@ -80,9 +80,11 @@ class Question
}
if (sizeof($questions) == 0) {
for ($i = 0; $i < 6; ++$i) {
$req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `number`, `question`) VALUES (?, ?, ?, ?, ?);");
$req->execute([$from->getId(), $to->getId(), $from->getProblem(), 0, ""]);
for ($i = 1; $i <= 6; ++$i) {
$req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `number`, `question`) VALUES (?, ?, ?, ?, ?);");
$req->execute([$from->getId(), $to->getId(), $from->getProblem(), $i, self::DEFAULT_QUESTIONS[$i]]);
$req->execute([$from->getId(), $to->getId(), $from->getProblem(), $i, self::DEFAULT_QUESTIONS[$i - 1]]);
}
return self::getQuestions($from, $to);
}