diff --git a/public/userarea/include/navigationbar.php b/public/userarea/include/navigationbar.php
index 2535f62..8eede55 100644
--- a/public/userarea/include/navigationbar.php
+++ b/public/userarea/include/navigationbar.php
@@ -1,8 +1,8 @@
-
-
+
+
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/public/userarea/ratego/calculate_supplier_ratings.php b/public/userarea/ratego/calculate_supplier_ratings.php
index 03cf86d..0bc4065 100644
--- a/public/userarea/ratego/calculate_supplier_ratings.php
+++ b/public/userarea/ratego/calculate_supplier_ratings.php
@@ -35,17 +35,26 @@ SELECT
WHEN LOWER(ap.test_Rating) NOT IN ('pass', 'p', 'comply', 'complies', 'fail', 'f', 'doesn\'t comply') THEN 1
ELSE 0
END) AS data_analyses,
- GREATEST(0, 10 - (
- SUM(
- CASE
- WHEN LOWER(ap.test_Rating) IN ('fail', 'f', 'doesn\'t comply') THEN
- COALESCE(asv.severity, 1) *
- CASE WHEN COALESCE(asv.is_legal, 'N') = 'Y' THEN 1.5 ELSE 1.0 END
- ELSE 0
- END
- ) * (1 + SUM(CASE WHEN LOWER(ap.test_Rating) IN ('fail', 'f', 'doesn\'t comply') THEN 1 ELSE 0 END) / NULLIF(COUNT(ap.idAnalysis_Project), 0))
- / NULLIF(COUNT(ap.idAnalysis_Project), 0) * 100
- )) AS rating,
+ CASE
+ WHEN SUM(CASE WHEN LOWER(ap.test_Rating) IN ('fail', 'f', 'doesn\'t comply') THEN 1 ELSE 0 END) = 0
+ AND SUM(CASE WHEN LOWER(ap.test_Rating) NOT IN ('pass', 'p', 'comply', 'complies', 'fail', 'f', 'doesn\'t comply') THEN 1 ELSE 0 END) = 0
+ THEN 100
+ ELSE GREATEST(0, 100 - (
+ SUM(
+ CASE
+ WHEN LOWER(ap.test_Rating) IN ('fail', 'f', 'doesn\'t comply') THEN
+ POWER(COALESCE(asv.severity, 1), 2) *
+ CASE WHEN COALESCE(asv.is_legal, 'N') = 'Y' THEN 2.0 ELSE 1.0 END
+ ELSE 0
+ END
+ ) / NULLIF(COUNT(ap.idAnalysis_Project), 0) * 100 *
+ (1 + 2 * (SUM(CASE WHEN LOWER(ap.test_Rating) IN ('fail', 'f', 'doesn\'t comply') THEN 1 ELSE 0 END) / NULLIF(COUNT(ap.idAnalysis_Project), 0)))
+ + SUM(CASE
+ WHEN LOWER(ap.test_Rating) NOT IN ('pass', 'p', 'comply', 'complies', 'fail', 'f', 'doesn\'t comply') THEN 0.3
+ ELSE 0
+ END)
+ ))
+ END AS rating,
NOW() AS calculation_date
FROM products p
JOIN reports r ON p.idproducts = r.idproducts
@@ -61,7 +70,6 @@ ON DUPLICATE KEY UPDATE
data_analyses = VALUES(data_analyses),
rating = VALUES(rating),
calculation_date = VALUES(calculation_date);
-
";
if ($conn->query($query) === TRUE) {
diff --git a/public/userarea/ratego/ratego.php b/public/userarea/ratego/ratego.php
index bd3a3bb..f95d2ab 100644
--- a/public/userarea/ratego/ratego.php
+++ b/public/userarea/ratego/ratego.php
@@ -32,6 +32,7 @@
+
@@ -46,14 +47,22 @@
-
-
-
-
Supplier Ratings
+
+
+
+
@@ -64,6 +73,24 @@
+
+
+
+
+
+
+
+
+