make stats page not laggy

This commit is contained in:
biglyderv 2025-01-29 13:07:51 -05:00
parent 14409dd748
commit 2fa3b4f4e1

View file

@ -19,10 +19,12 @@
$stmt = $db->prepare("SELECT * FROM main.auth");
$stmt->execute([]);
$result = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$result = array_reverse($result,true);
$pr = array();
$fcount = array();
$frs = array();
$fng = array();
$matrixe = array();
$msum_old = 0;
@ -34,13 +36,14 @@
$stmt = $db->prepare("SELECT * FROM main.follow WHERE target = ? AND NOT username = ?");
$stmt->execute([$fn,$fn]);
$fcount[$fn] = count($stmt->fetchAll(PDO::FETCH_DEFAULT));
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
$stmt->execute([$fn]);
$fng[$fn] = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$fcount[$fn] = count($fng[$fn]);
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ? AND NOT target = ?");
$stmt->execute([$fn,$fn]);
$frs[$fn] = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$matrixe[$fn] = array();
$matrixe[$fn][$fn] = 1;
$msum_old++;
@ -73,14 +76,14 @@
foreach ($result as $usera) {
$una = $usera['username'];
$pr[$una] = 0.1;
$pr[$una] = 0;
if (count($frs[$una]) == 0) continue;
foreach ($result as $userb) {
$unb = $userb['username'];
$prb = $prold[$unb];
if ($prb < 1 / 1e6) {
$msum += $matrixe[$una][$unb];
if ($prb < 1 / 1e3 || count($fng[$unb]) == 0) {
//$msum += $matrixe[$una][$unb];
continue;
}
$matrixe[$una][$unb] = 0.03;
@ -97,6 +100,7 @@
foreach ($result as $usera) {
$una = $usera['username'];
if (count($frs[$una]) == 0) continue;
foreach ($result as $userb) {
$unb = $userb['username'];