Datum vom ersten Datenpunkt im Test nehmen; Startseite hübscher
This commit is contained in:
parent
3db8f20f27
commit
fdc2eb6c07
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function return_success() {
|
function return_success($msg = 'OK') {
|
||||||
return json_encode(['status' => 'success', 'message' => 'OK']);
|
return json_encode(['status' => 'success', 'message' => $msg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function return_error($code, $msg) {
|
function return_error($code, $msg) {
|
||||||
|
@ -10,6 +10,8 @@ use Twig\Loader\FilesystemLoader;
|
|||||||
$loader = new FilesystemLoader(__DIR__ . '/templates');
|
$loader = new FilesystemLoader(__DIR__ . '/templates');
|
||||||
$twig = new Environment($loader);
|
$twig = new Environment($loader);
|
||||||
|
|
||||||
|
setlocale(LC_ALL, 'de-DE');
|
||||||
|
|
||||||
// --------------
|
// --------------
|
||||||
|
|
||||||
$dbconn = pg_connect($dbconnstring)
|
$dbconn = pg_connect($dbconnstring)
|
||||||
|
@ -5,11 +5,12 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% if tests is not empty %}
|
{% if tests is not empty %}
|
||||||
<div>Test auswählen:</div>
|
<h2 class="text-center">Test auswählen:</h2>
|
||||||
<table class="table">
|
|
||||||
|
<table class="table table-bordered w-auto mx-auto">
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for test in tests %}
|
{% for test in tests %}
|
||||||
<tr><td><a href="test.php?id={{ test.id }}">{{ test.timestamp }}</td></tr>
|
<tr><td><a href="test.php?id={{ test.id }}">{{ test.timestamp | date('D j. M Y, H:i:s') }}</td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -63,7 +63,9 @@ function test_finished() {
|
|||||||
or die(return_error(500, 'connect Datenbankfehler: ' . pg_last_error()));
|
or die(return_error(500, 'connect Datenbankfehler: ' . pg_last_error()));
|
||||||
|
|
||||||
$query = "INSERT INTO tests VALUES (DEFAULT, $1, $2) RETURNING id";
|
$query = "INSERT INTO tests VALUES (DEFAULT, $1, $2) RETURNING id";
|
||||||
$values = [ date('Y-m-d H:i:s'), json_encode($data) ];
|
|
||||||
|
$date = $data['test']['data']['temperatureSamples'][0]['time'];
|
||||||
|
$values = [ $date, json_encode($data) ];
|
||||||
|
|
||||||
$rc = pg_query_params($dbconn, $query, $values);
|
$rc = pg_query_params($dbconn, $query, $values);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user