From 209356b8ade1920b50d1d3a1a5e121c6623d167b Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 11 Nov 2022 23:47:49 +0100 Subject: Update --- pages/byfront.inc | 188 +++++++++++++++++++++++++----------------------------- 1 file changed, 88 insertions(+), 100 deletions(-) (limited to 'pages/byfront.inc') diff --git a/pages/byfront.inc b/pages/byfront.inc index 280d981..77556a2 100644 --- a/pages/byfront.inc +++ b/pages/byfront.inc @@ -11,52 +11,100 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ

Members by last fronted

-

Cloudburst System

- 0) { - $thisIndex = array_search($thisMember[0], $switches); - - $frontingStart = $thisMember[0]; - $frontingEnd = $switches[$thisIndex - 1]; + 0) { + $thisIndex = array_search($thisMember[0], $switches); + + $frontingStart = $thisMember[0]; + $frontingEnd = $switches[$thisIndex - 1]; + } + + if ($frontingEnd !== null && isset($frontingStart)) { + $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + } } - if ($frontingEnd !== null && isset($frontingStart)) { - $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + return $i; + }, array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "ynmuc"; + }))), + ...array_map(function ($i) { + $system = "gdapd"; + $i["_lastFronted"] = -1; + $id = $i["id"]; + $memberData = $i; + + $fronters = array_map(function ($item) { + return $item["id"]; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true)["members"]); + + if (in_array($id, $fronters)) { + $i["_lastFronted"] = time(); + } else { + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true); + + $thisMember = array_filter($switches, function ($item) use ($memberData) { + return in_array($memberData["id"], $item["members"]); + }); + + $thisMember = array_values($thisMember); + $frontingEnd = null; + + if (count($thisMember) > 0) { + $thisIndex = array_search($thisMember[0], $switches); + + $frontingStart = $thisMember[0]; + $frontingEnd = $switches[$thisIndex - 1]; + } + + if ($frontingEnd !== null && isset($frontingStart)) { + $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + } } - } - return $i; - }, array_values(array_filter(scoreOrderGlobal(), function ($i) { - return $i["_system"] === "ynmuc"; - }))); uasort($members, function ($a, $b) { + return $i; + }, array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "gdapd"; + }))) + ]; uasort($members, function ($a, $b) { return $b["_lastFronted"] - $a["_lastFronted"]; - }); foreach ($members as $member): ?> -
+ }); $members = array_reverse($members); foreach ($members as $member): if ($member["_lastFronted"] !== -1 && $member["_lastFronted"] !== time()): ?> +
time() - (86400 * 14)): ?>rgba(255, 255, 255, .1) time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)rgba(255,55,55,0.17);;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;opacity: 0.75;"> "> " style="width:24px;">  - -  Not sharing memory - + + + Memory + + + Travelling + + + Must front + +
@@ -67,67 +115,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
- - -
-

Raindrops System

- 0) { - $thisIndex = array_search($thisMember[0], $switches); - - $frontingStart = $thisMember[0]; - $frontingEnd = $switches[$thisIndex - 1]; - } - - if ($frontingEnd !== null && isset($frontingStart)) { - $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); - } - } - - return $i; - }, array_values(array_filter(scoreOrderGlobal(), function ($i) { - return $i["_system"] === "gdapd"; - }))); uasort($members, function ($a, $b) { - return $b["_lastFronted"] - $a["_lastFronted"]; - }); foreach ($members as $member): ?> -
- "> - " style="width:24px;">  - -  Not sharing memory - - - -
- - Never fronted - - Last fronted () - -
-
- -
+