From 654ab09772936bd01413968f71a97923293f319d Mon Sep 17 00:00:00 2001 From: Claudio Date: Tue, 5 Nov 2024 17:16:17 +0100 Subject: [PATCH] added indicator in dashboard --- public/userarea/index.php | 169 +++++++++++++++++++++++--------------- 1 file changed, 103 insertions(+), 66 deletions(-) diff --git a/public/userarea/index.php b/public/userarea/index.php index cddd7fb..b6320be 100644 --- a/public/userarea/index.php +++ b/public/userarea/index.php @@ -2,6 +2,45 @@ query($totalProductsQuery); +$totalProducts = $totalProductsResult->fetch_assoc()['totalProducts']; + +// Query 2: Numero totale di report +$totalReportsQuery = " + SELECT COUNT(DISTINCT r.idreports) AS totalReports + FROM reports r + LEFT JOIN products p ON r.idproducts = p.idproducts"; +$totalReportsResult = $conn->query($totalReportsQuery); +$totalReports = $totalReportsResult->fetch_assoc()['totalReports']; + +// Query 3: Numero di report "fail" +$failedReportsQuery = " + SELECT COUNT(DISTINCT r.idreports) AS failedReports + FROM reports r + LEFT JOIN products p ON r.idproducts = p.idproducts + WHERE UPPER(r.reportsRating) IN ('FAIL', 'F', 'DOESN\'T COMPLY')"; +$failedReportsResult = $conn->query($failedReportsQuery); +$failedReports = $failedReportsResult->fetch_assoc()['failedReports']; + +$totalTestsQuery = " + SELECT COUNT(DISTINCT ap.idreports, ap.idPart, ap.result_TestName) AS totalTests + FROM analysis_project ap + LEFT JOIN result_project rp ON ap.idAnalysis_Project = rp.idanalysis_project + LEFT JOIN reports r ON ap.idreports = r.idreports + LEFT JOIN products p ON r.idproducts = p.idproducts"; +$totalTestsResult = $conn->query($totalTestsQuery); +$totalTests = $totalTestsResult->fetch_assoc()['totalTests']; +// Verifica connessione +if ($conn->connect_error) { + die("Connessione fallita: " . $conn->connect_error); +} +?> +fetch_assoc()) {
-
-
-
-
-
-
-
-
- -
-
-
190
-

Custom indicator

-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- -
-
-
62
-

Custom indicator

-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
14
-

Custom indicator

-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
15562
-

Custom indicator

-
-
+
+
+

Total Products

-
+
+
+
+
+
+
+ +
+
+
+

Total Reports

+
+
+
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+

Failed Reports

+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+

Total Tests

+
+
+
+
+
+
+