diff --git a/app/scripts/database_queries.php b/app/scripts/database_queries.php
index 5e93da8..7ebfcf3 100644
--- a/app/scripts/database_queries.php
+++ b/app/scripts/database_queries.php
@@ -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");
diff --git a/app/scripts/functions.php b/app/scripts/functions.php
index 839e775..d4ccdfe 100644
--- a/app/scripts/functions.php
+++ b/app/scripts/functions.php
@@ -37,9 +37,15 @@ function generate_password_hash($password, $salt) {
function load_stations_table($con) {
$stmt = get_stations_all($con);
foreach($stmt->fetchAll() as $row) {
+ if ($row['gewertet'] == '1') {
+ $checked = "ja";
+ } else {
+ $checked = "nein";
+ }
echo "