From 8cc1f13c17fa2fb5a4410542d39e650e02945634 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 23 Feb 2023 14:20:13 +0100 Subject: Updated 27 files, added assets/uploads/pt-twilightsparkle.png and deleted 3 files (automated) --- includes/score.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'includes/score.inc') 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"]; }); -- cgit