Points are now only counted if it is selected

This commit is contained in:
Grisu
2022-09-04 16:51:47 +02:00
parent 0f221c9303
commit 83c62d0015
4 changed files with 32 additions and 1 deletions

View File

@@ -87,7 +87,7 @@ function get_teams($con) {
function get_total_score($con) {
try {
$stmt = $con->prepare("SELECT M.name as Mannschaftsname, M.feuerwehr as Feuerwehr, SUM(P.punkte) as Gesamtpunkte FROM Punkte as P, Mannschaft as M WHERE P.m_id = M.m_id GROUP BY M.m_id ORDER BY Gesamtpunkte DESC");
$stmt = $con->prepare("SELECT M.name as Mannschaftsname, M.feuerwehr as Feuerwehr, SUM(P.punkte) as Gesamtpunkte FROM Punkte as P, Mannschaft as M, Station as S WHERE P.m_id = M.m_id AND P.s_id = S.s_id AND S.gewertet = \"1\" GROUP BY M.m_id ORDER BY Gesamtpunkte DESC");
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
return $stmt;
@@ -393,6 +393,17 @@ function update_station_pos($con, $s_id, $pos) {
}
}
function update_station_gewertet($con, $s_id, $gewertet) {
try {
$stmt = $con->prepare("UPDATE Station SET gewertet = ? WHERE s_id = ?");
$stmt->bindParam(1, $gewertet, PDO::PARAM_INT);
$stmt->bindParam(2, $s_id, PDO::PARAM_INT);
$stmt->execute();
} catch(PDOExeption $e) {
handle_pdo_exception($e);
}
}
function get_team($con, $m_id) {
try {
$stmt = $con->prepare("SELECT * FROM Mannschaft WHERE m_id = :m_id");