mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-30 13:11:13 +02:00
First week fixes
This commit is contained in:
@ -157,6 +157,7 @@ class Synthesis
|
||||
private $team_id;
|
||||
private $tournament_id;
|
||||
private $dest;
|
||||
private $round;
|
||||
private $uploaded_at;
|
||||
private $version;
|
||||
|
||||
@ -187,7 +188,8 @@ class Synthesis
|
||||
$this->file_id = $data["file_id"];
|
||||
$this->team_id = $data["team"];
|
||||
$this->tournament_id = $data["tournament"];
|
||||
$this->dest = DestType::fromName($data["dest"]);
|
||||
$this->dest = $data["dest"];
|
||||
$this->round = $data["round"];
|
||||
$this->uploaded_at = $data["uploaded_at"];
|
||||
$this->version = isset($data["version"]) ? $data["version"] : 1;
|
||||
}
|
||||
@ -207,10 +209,15 @@ class Synthesis
|
||||
return $this->tournament_id;
|
||||
}
|
||||
|
||||
public function getDest()
|
||||
{
|
||||
return $this->dest;
|
||||
}
|
||||
public function getDest()
|
||||
{
|
||||
return $this->dest;
|
||||
}
|
||||
|
||||
public function getRound()
|
||||
{
|
||||
return $this->round;
|
||||
}
|
||||
|
||||
public function getUploadedAt()
|
||||
{
|
||||
|
@ -12,7 +12,9 @@ class Tournament
|
||||
private $date_start, $date_end;
|
||||
private $date_inscription;
|
||||
private $date_solutions;
|
||||
private $date_syntheses;
|
||||
private $date_syntheses;
|
||||
private $date_solutions_2;
|
||||
private $date_syntheses_2;
|
||||
private $final;
|
||||
private $organizers = [];
|
||||
private $year;
|
||||
@ -98,8 +100,10 @@ class Tournament
|
||||
$this->date_start = $data["date_start"];
|
||||
$this->date_end = $data["date_end"];
|
||||
$this->date_inscription = $data["date_inscription"];
|
||||
$this->date_solutions = $data["date_solutions"];
|
||||
$this->date_syntheses = $data["date_syntheses"];
|
||||
$this->date_solutions = $data["date_solutions"];
|
||||
$this->date_solutions_2 = $data["date_solutions_2"];
|
||||
$this->date_syntheses = $data["date_syntheses"];
|
||||
$this->date_syntheses_2 = $data["date_syntheses_2"];
|
||||
$this->final = $data["final"] == true;
|
||||
$this->year = $data["year"];
|
||||
|
||||
@ -224,17 +228,41 @@ class Tournament
|
||||
$DB->prepare("UPDATE `tournaments` SET `date_solutions` = ? WHERE `id` = ?;")->execute([$date, $this->id]);
|
||||
}
|
||||
|
||||
public function getSynthesesDate()
|
||||
{
|
||||
return $this->date_syntheses;
|
||||
}
|
||||
public function getSynthesesDate()
|
||||
{
|
||||
return $this->date_syntheses;
|
||||
}
|
||||
|
||||
public function setSynthesesDate($date)
|
||||
{
|
||||
global $DB;
|
||||
$this->date_syntheses = $date;
|
||||
$DB->prepare("UPDATE `tournaments` SET `date_syntheses` = ? WHERE `id` = ?;")->execute([$date, $this->id]);
|
||||
}
|
||||
public function setSynthesesDate($date)
|
||||
{
|
||||
global $DB;
|
||||
$this->date_syntheses = $date;
|
||||
$DB->prepare("UPDATE `tournaments` SET `date_syntheses` = ? WHERE `id` = ?;")->execute([$date, $this->id]);
|
||||
}
|
||||
|
||||
public function getSolutionsDate2()
|
||||
{
|
||||
return $this->date_solutions_2;
|
||||
}
|
||||
|
||||
public function setSolutionsDate2($date)
|
||||
{
|
||||
global $DB;
|
||||
$this->date_solutions_2 = $date;
|
||||
$DB->prepare("UPDATE `tournaments` SET `date_solutions_2` = ? WHERE `id` = ?;")->execute([$date, $this->id]);
|
||||
}
|
||||
|
||||
public function getSynthesesDate2()
|
||||
{
|
||||
return $this->date_syntheses_2;
|
||||
}
|
||||
|
||||
public function setSynthesesDate2($date)
|
||||
{
|
||||
global $DB;
|
||||
$this->date_syntheses_2 = $date;
|
||||
$DB->prepare("UPDATE `tournaments` SET `date_syntheses_2` = ? WHERE `id` = ?;")->execute([$date, $this->id]);
|
||||
}
|
||||
|
||||
public function isFinal()
|
||||
{
|
||||
@ -343,9 +371,9 @@ class Tournament
|
||||
global $DB;
|
||||
|
||||
$req = $DB->query("SELECT * FROM `syntheses` AS `t1` "
|
||||
. "INNER JOIN (SELECT `team`, `dest`, `tournament`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `syntheses` GROUP BY `tournament`, `team`, `dest`) `t2` "
|
||||
. "ON `t1`.`team` = `t2`.`team` AND `t1`.`dest` = `t2`.`dest` AND `t1`.`tournament` = `t2`.`tournament` "
|
||||
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`tournament` = $this->id " . ($team_id == -1 ? "" : "AND `t1`.`team` = $team_id") . " ORDER BY `t1`.`team`, `t1`.`dest`;");
|
||||
. "INNER JOIN (SELECT `team`, `dest`, `round`, `tournament`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `syntheses` GROUP BY `tournament`, `team`, `dest`, `round`) `t2` "
|
||||
. "ON `t1`.`team` = `t2`.`team` AND `t1`.`dest` = `t2`.`dest` AND `t1`.`tournament` = `t2`.`tournament` AND `t1`.`round` = `t2`.`round` "
|
||||
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`tournament` = $this->id " . ($team_id == -1 ? "" : "AND `t1`.`team` = $team_id") . " ORDER BY `t1`.`team`, `t1`.`round`, `t1`.`dest`;");
|
||||
|
||||
$syntheses = [];
|
||||
|
||||
|
Reference in New Issue
Block a user