1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-03 15:22:48 +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

@ -26,6 +26,7 @@ class AnswerQuestions
* @var Team $to_team
*/
private $from_team;
private $answer_0;
private $answer_1;
private $answer_2;
private $answer_3;
@ -46,7 +47,7 @@ class AnswerQuestions
$this->files = [];
$this->has_files = false;
for ($i = 1; $i <= 6; ++$i) {
for ($i = 0; $i <= 6; ++$i) {
if (strlen($files["file_$i"]["name"]) > 0) {
$this->files[] = $files["file_$i"];
$this->has_files = true;
@ -55,7 +56,7 @@ class AnswerQuestions
$this->files[] = null;
}
$this->answers = [$this->answer_1, $this->answer_2, $this->answer_3, $this->answer_4, $this->answer_5, $this->answer_6];
$this->answers = [$this->answer_0, $this->answer_1, $this->answer_2, $this->answer_3, $this->answer_4, $this->answer_5, $this->answer_6];
}
public function makeVerifications()
@ -67,12 +68,12 @@ class AnswerQuestions
ensure($team->getProblem() == $this->from_team->getProblem(), "Les équipes ne travaillent pas sur le même problème.");
ensure(!$this->has_files || $this->no_drawing, "Vous devez confirmer ne pas avoir inclus de texte dans vos pièces jointes.");
for ($i = 0; $i < 6; ++$i) {
for ($i = 1; $i <= 6; ++$i) {
if ($this->answers[$i] == "")
$this->answers[$i] = null;
}
for ($i = 0; $i < 6; ++$i) {
for ($i = 0; $i <= 6; ++$i) {
ensure($this->files[$i]["size"] <= 2e6, "Le fichier doit peser moins que 2 Mo.");
ensure(!$this->files[$i]["error"], "Une erreur est survenue. Veuillez vérifier vos pièces jointes. Elles ne doivent pas peser plus de 2 Mo chacune.");
}
@ -86,7 +87,7 @@ class AnswerQuestions
/** @var Question[] $questions */
$questions = Question::getQuestions($this->from_team, $team);
for ($i = 0; $i < 6; ++$i) {
for ($i = 0; $i <= 6; ++$i) {
$question = $questions[$i];
if ($question->getAnswer() != $this->answers[$i] && $question->getAttachedFileAnswer() != null) {
unlink("$LOCAL_PATH/files/" . $question->getAttachedFileAnswer());