diff options
author | Minteck <contact@minteck.org> | 2023-02-23 14:20:13 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-23 14:20:13 +0100 |
commit | 8cc1f13c17fa2fb5a4410542d39e650e02945634 (patch) | |
tree | e3f668e635253310b97fb379d71318dc96d1dd2d /includes/score.inc | |
parent | 6563d542af0930ebb6b2f9b71f2b7538d7467665 (diff) | |
download | pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.tar.gz pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.tar.bz2 pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.zip |
Updated 27 files, added assets/uploads/pt-twilightsparkle.png and deleted 3 files (automated)
Diffstat (limited to 'includes/score.inc')
-rw-r--r-- | includes/score.inc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/includes/score.inc b/includes/score.inc index 96925bf..991c132 100644 --- a/includes/score.inc +++ b/includes/score.inc @@ -60,6 +60,9 @@ function scoreOrder($members, $system) { } function scoreOrderGlobal() { + global $isLowerLoggedIn; + global $isLoggedIn; + $ordered = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json")) { @@ -81,6 +84,19 @@ function scoreOrderGlobal() { } } + if ($isLowerLoggedIn || $isLoggedIn) { + $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true) as $member) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json")) { + $member["_system"] = $app["other"]["id"]; + $member["system"] = $app["other"]["id"]; + $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); + $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)), $member["display_name"] ?? $member["name"]); + $ordered[] = $member; + } + } + } + uasort($ordered, function($a, $b) { return $b["_score"]["total"] - $a["_score"]["total"]; }); |