Browse code

includes/seriesreviews.php: Another one slipped away...

Clarissa Walker authored on 2026/09/13 00:00:12
Showing 1 changed files
... ...
@@ -67,11 +67,19 @@ while($parent) {
67 67
 		if($pst['sid']) $pstorylist[] = $pst['sid'];
68 68
 		else if($pst['subseriesid']) $pserieslist[] = $pst['subseriesid'];
69 69
 	}
70
-	$pnewrating = dbquery("SELECT AVG(rating) as totalcount FROM ".TABLEPREFIX."fanfiction_reviews 
71
-		WHERE ((item = '$parent' AND type = 'SE')".
72
-		(count($pstorylist) > 0 ? " OR (FIND_IN_SET(item, '".(implode(",", $pstorylist))."') > 0 AND type = 'ST')" : "").
73
-		(count($pserieslist) > 0 ? " OR (FIND_IN_SET(item, '".(implode(",", $pserieslist))."') > 0 AND type = 'SE')" : "").
74
-		") AND rating != '-1'");
70
+	if($ratings == 3) {
71
+		$pnewrating = dbquery("SELECT COUNT(rating) as totalcount FROM ".TABLEPREFIX."fanfiction_reviews
72
+			WHERE ((item = '$parent' AND type = 'SE')".
73
+			(count($pstorylist) > 0 ? " OR (FIND_IN_SET(item, '".(implode(",", $pstorylist))."') > 0 AND type = 'ST')" : "").
74
+			(count($pserieslist) > 0 ? " OR (FIND_IN_SET(item, '".(implode(",", $pserieslist))."') > 0 AND type = 'SE')" : "").
75
+			") AND rating != '-1'");
76
+	} else {
77
+		$pnewrating = dbquery("SELECT AVG(rating) as totalcount FROM ".TABLEPREFIX."fanfiction_reviews
78
+			WHERE ((item = '$parent' AND type = 'SE')".
79
+			(count($pstorylist) > 0 ? " OR (FIND_IN_SET(item, '".(implode(",", $pstorylist))."') > 0 AND type = 'ST')" : "").
80
+			(count($pserieslist) > 0 ? " OR (FIND_IN_SET(item, '".(implode(",", $pserieslist))."') > 0 AND type = 'SE')" : "").
81
+			") AND rating != '-1'");
82
+	}
75 83
 	$pnewcount = dbquery("SELECT count(review) as totalcount FROM ".TABLEPREFIX."fanfiction_reviews 
76 84
 		WHERE ((item = '$parent' AND type = 'SE')".
77 85
 		(count($pstorylist) > 0 ? " OR (FIND_IN_SET(item, '".(implode(",", $pstorylist))."') > 0 AND type = 'ST')" : "").