people who follow more people distribute their rank less
This commit is contained in:
parent
0271be9256
commit
78f1e016c1
1 changed files with 10 additions and 2 deletions
|
@ -27,8 +27,16 @@
|
||||||
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||||
|
|
||||||
foreach ($followers as $follown) {
|
foreach ($followers as $follown) {
|
||||||
if ($usern['username'] == $follown['target']) continue;
|
$fn = $follown['target'];
|
||||||
$pr[$usern['username']] += $pr[$follown['target']] / 10;
|
|
||||||
|
if ($usern['username'] == $fn) continue;
|
||||||
|
|
||||||
|
$stmt = $db->prepare("SELECT * FROM main.follow WHERE target = ? AND NOT username = ?");
|
||||||
|
$stmt->execute([$fn,$fn]);
|
||||||
|
|
||||||
|
$dst = count($stmt->fetchAll(PDO::FETCH_DEFAULT));
|
||||||
|
|
||||||
|
$pr[$usern['username']] += $pr[$fn] / ($dst + 5) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$h = $pr[$usern['username']];
|
$h = $pr[$usern['username']];
|
||||||
|
|
Loading…
Reference in a new issue