you can now set if a station needs points or get the results of the excersice and the website should calculate the points
This commit is contained in:
@@ -167,11 +167,12 @@ function write_points($con, $s_id, $m_id, $points, $time) {
|
||||
}
|
||||
}
|
||||
|
||||
function write_station($con, $station_name, $station_pos) {
|
||||
function write_station($con, $station_name, $station_pos, $station_direct_points) {
|
||||
try {
|
||||
$stmt = $con->prepare("INSERT INTO Station (name, standort) VALUES (?, ?)");
|
||||
$stmt = $con->prepare("INSERT INTO Station (name, standort, direkte_punkte) VALUES (?, ?, ?)");
|
||||
$stmt->bindParam(1, $station_name, PDO::PARAM_STR);
|
||||
$stmt->bindParam(2, $station_pos, PDO::PARAM_STR);
|
||||
$stmt->bindParam(3, $station_direct_points, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exceptio($e);
|
||||
@@ -426,6 +427,17 @@ function update_station_gewertet($con, $s_id, $gewertet) {
|
||||
}
|
||||
}
|
||||
|
||||
function update_station_direct_points($con, $s_id, $direct_points) {
|
||||
try {
|
||||
$stmt = $con->prepare("UPDATE Station SET direkte_punkte = ? WHERE s_id = ?");
|
||||
$stmt->bindParam(1, $direct_points, 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");
|
||||
|
||||
@@ -38,14 +38,20 @@ function load_stations_table($con) {
|
||||
$stmt = get_stations_all($con);
|
||||
foreach($stmt->fetchAll() as $row) {
|
||||
if ($row['gewertet'] == '1') {
|
||||
$checked = "ja";
|
||||
$checked = "Ja";
|
||||
} else {
|
||||
$checked = "nein";
|
||||
$checked = "Nein";
|
||||
}
|
||||
if ($row['direkte_punkte'] == '1') {
|
||||
$direkte_punkte = "Ja";
|
||||
} else {
|
||||
$direkte_punkte = "Nein";
|
||||
}
|
||||
echo "<tr id=\"" . $row['s_id'] . "\">";
|
||||
echo "<td>" . $row['name'] . "</td>";
|
||||
echo "<td>" . $row['standort'] . "</td>";
|
||||
echo "<td>". $checked . "</td>";
|
||||
echo "<td>" . $direkte_punkte . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user