Suppression de la fonction d'énigme bonus + changement du nom de l'app.

This commit is contained in:
antux18 2024-02-13 10:36:59 +01:00
parent d2ea5ebbcd
commit b2bdc6350f
8 changed files with 16 additions and 59 deletions

View File

@ -56,17 +56,6 @@
$stmt->bindValue(":puzzle_id", $art_id); $stmt->bindValue(":puzzle_id", $art_id);
$stmt->bindValue(":team_id", $team_id); $stmt->bindValue(":team_id", $team_id);
$stmt->execute(); $stmt->execute();
// On ajoute l'énigme bonus si toutes les autres sont résolues :
$stmt = $database->pdo_teams->prepare("SELECT COUNT(*) FROM solved WHERE team_id == :team_id");
$stmt->bindValue(":team_id", $team_id);
$stmt->execute();
if ($stmt->fetchAll()[0]["COUNT(*)"] == "12") { // Il y a 12 énigmes sans compter la bonus
$stmt = $database->pdo_teams->prepare("UPDATE teams SET bonus = 1 WHERE id = :team_id");
$stmt->bindValue(":team_id", $team_id);
$stmt->execute();
}
} }
$data["valid_qr"] = true; $data["valid_qr"] = true;

View File

@ -27,18 +27,6 @@
} }
else { else {
// On vérifie si l'énigme bonus n'est pas débloquée :
if (!$database->checkTeamBonus($team_id)) {
// Si c'est celle qui est sélectionnée, on retourne à la liste des énigmes :
if ($art_id == $max_art) {
header("Location: puzzles.php?team=" . $team_id);
die();
}
// On retire l'énigme bonus du total :
$max_art--;
}
// On indique si l'énigme est résolue : // On indique si l'énigme est résolue :
$stmt = $database->pdo_teams->prepare("SELECT * FROM solved WHERE (team_id == :team_id AND puzzle_id == :puzzle_id)"); $stmt = $database->pdo_teams->prepare("SELECT * FROM solved WHERE (team_id == :team_id AND puzzle_id == :puzzle_id)");
$stmt->bindValue(":team_id", $team_id); $stmt->bindValue(":team_id", $team_id);

Binary file not shown.

Binary file not shown.

View File

@ -31,20 +31,7 @@
false false
); );
// On vérifie si l'équipe a débloqué l'énigme bonus : $stmt = $database->pdo_article->prepare("SELECT * FROM puzzles");
$stmt = $database->pdo_teams->prepare("SELECT * FROM teams WHERE id = :id");
$stmt->bindValue(":id", $team_id);
$stmt->execute();
// Si c'est le cas, on affiche toutes les énigmes :
if ($stmt->fetchAll()[0][1] == 1) {
$stmt = $database->pdo_article->prepare("SELECT * FROM puzzles");
}
// Sinon, on cache la bonus :
else {
$stmt = $database->pdo_article->prepare("SELECT * FROM puzzles WHERE id <> 13");
}
$stmt->execute(); $stmt->execute();
$puzzles = $stmt->fetchAll(); $puzzles = $stmt->fetchAll();

View File

@ -24,7 +24,6 @@
$this->pdo_teams = new PDO("sqlite:" . dirname(__FILE__) . $data_path . "teams.db"); $this->pdo_teams = new PDO("sqlite:" . dirname(__FILE__) . $data_path . "teams.db");
$this->pdo_teams->query('CREATE TABLE IF NOT EXISTS "teams" ( $this->pdo_teams->query('CREATE TABLE IF NOT EXISTS "teams" (
"id" INTEGER NOT NULL UNIQUE, "id" INTEGER NOT NULL UNIQUE,
"bonus" INTEGER NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT) PRIMARY KEY("id" AUTOINCREMENT)
)'); )');
@ -57,12 +56,6 @@
return $query->fetch()["COUNT(*)"]; return $query->fetch()["COUNT(*)"];
} }
function checkTeamBonus(int $team) {
// $team doit être une équipe existante :
$query = $this->pdo_teams->query("SELECT bonus FROM teams WHERE id = " . $team);
return $query->fetch()[0] == 1;
}
// public function getTeamsNb() { // public function getTeamsNb() {
// $query = $this->pdo_teams->query("SELECT COUNT(*) FROM teams"); // $query = $this->pdo_teams->query("SELECT COUNT(*) FROM teams");
// return $query->fetch()["COUNT(*)"]; // return $query->fetch()["COUNT(*)"];

View File

@ -1,19 +1,19 @@
<?php <?php
$tr = [ $tr = [
"tab_title" => [ "tab_title" => [
"home" => "Home - Lycée Pange Code Hunt", "home" => "Home - Citizenship Code Hunt",
"team_confirm" => "Team confirmation - Lycée Pange Code Hunt", "team_confirm" => "Team confirmation - Citizenship Code Hunt",
"puzzles" => "Puzzles list - Lycée Pange Code Hunt", "puzzles" => "Puzzles list - Citizenship Code Hunt",
"article" => "Puzzle - Lycée Pange Code Hunt" "article" => "Puzzle - Citizenship Code Hunt"
], ],
"page_title" => [ "page_title" => [
"home" => "Code Hunt", "home" => "Citizenship Code Hunt",
"team_confirm" => "Team confirmation", "team_confirm" => "Team confirmation",
"puzzles" => "Puzzles list for team n°", "puzzles" => "Puzzles list for team n°",
"article" => "Puzzle n°" "article" => "Puzzle n°"
], ],
"home" => [ "home" => [
"subtitle" => "Welcome to the code hunt of Lycée Jean de Pange of Sarreguemines !", "subtitle" => "Welcome to the Citizenship Code Hunt !",
"message" => "Enter your team number to begin :", "message" => "Enter your team number to begin :",
"team" => "Team number...", "team" => "Team number...",
"button" => "OK" "button" => "OK"
@ -38,7 +38,7 @@
"map_desc" => "Here is a map showing the location of the puzzles you already solved :" "map_desc" => "Here is a map showing the location of the puzzles you already solved :"
], ],
"nav" => [ "nav" => [
"title" => "Code Hunt Pange", "title" => "Citizenship Code Hunt",
"home" => "Home" "home" => "Home"
], ],
"footer" => [ "footer" => [

View File

@ -1,19 +1,19 @@
<?php <?php
$tr = [ $tr = [
"tab_title" => [ "tab_title" => [
"home" => "Accueil - Chasse au code Lycée Pange", "home" => "Accueil - Jeu de Pistes de la Citoyenneté",
"team_confirm" => "Confirmation du choix d'équipe - Chasse au code Lycée Pange", "team_confirm" => "Confirmation du choix d'équipe - Jeu de Pistes de la Citoyenneté",
"puzzles" => "Liste des énigmes - Chasse au code Lycée Pange", "puzzles" => "Liste des énigmes - Jeu de Pistes de la Citoyenneté",
"article" => "Énigme - Chasse au code Lycée Pange" "article" => "Énigme - Jeu de Pistes de la Citoyenneté"
], ],
"page_title" => [ "page_title" => [
"home" => "Chasse au code", "home" => "Jeu de Pistes de la Citoyenneté",
"team_confirm" => "Confirmation du choix d'équipe", "team_confirm" => "Confirmation du choix d'équipe",
"puzzles" => "Liste des puzzles pour l'équipe n°", "puzzles" => "Liste des puzzles pour l'équipe n°",
"article" => "Énigme n°" "article" => "Énigme n°"
], ],
"home" => [ "home" => [
"subtitle" => "Bienvenue à la chasse au code du Lycée Jean de Pange de Sarreguemines !", "subtitle" => "Bienvenue dans le Jeu de Pistes de la Citoyenneté !",
"message" => "Pour commencer, veuillez entrer le numéro de votre équipe :", "message" => "Pour commencer, veuillez entrer le numéro de votre équipe :",
"team" => "Numéro d'équipe...", "team" => "Numéro d'équipe...",
"button" => "Valider" "button" => "Valider"
@ -38,11 +38,11 @@
"map_desc" => "Voici la carte des emplacements des énigmes que vous avez résolues :" "map_desc" => "Voici la carte des emplacements des énigmes que vous avez résolues :"
], ],
"nav" => [ "nav" => [
"title" => "Chasse au code Pange", "title" => "Jeu de Pistes de la Citoyenneté",
"home" => "Accueil" "home" => "Accueil"
], ],
"footer" => [ "footer" => [
"text" => "Lycée Jean de Pange Sarreguemines<br><a href='https://forge.chapril.org/antux18/ChasseTresorPange'>Code source</a>" "text" => "Lycée Jean de Pange Sarreguemines<br><a href='https://forge.chapril.org/Antux/JeuPistesSarreguemines'>Code source</a>"
] ]
]; ];
?> ?>