0, "morning" => 0, "afternoon" => 0, "evening" => 0 ]; foreach ($i["_datesRaw"] as $date) { if ($date < 16200 || $date >= 75600) $i["_datesValues"]["night"]++; if ($date >= 61200 && $date < 75600) $i["_datesValues"]["evening"]++; if ($date >= 39600 && $date < 61200) $i["_datesValues"]["afternoon"]++; if ($date >= 16200 && $date < 39600) $i["_datesValues"]["morning"]++; } if (($i["_metadata"]["little"] === 2 || $i["_metadata"]["shared_memory"] < 2) && !$weekend) { $i["_datesValues"]["morning"] = 0; $i["_datesValues"]["afternoon"] = 0; } $i["_dates"] = array_values(array_filter(array_keys($i["_datesValues"]), function ($j) use ($i) { return $i["_datesValues"][$j] > 0; })); uasort($i["_dates"], function ($a, $b) use ($i) { return $i["_datesValues"][$b] - $i["_datesValues"][$a]; }); $i["_dates"] = array_values($i["_dates"]); $id = $i["id"]; $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 { $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) use ($system, $travelling) { return $i["_system"] === $system && (!in_array($i["id"], array_keys($travelling)) || !$travelling[$i["id"]]["travelling"]) && !isset($i["_metadata"]["median"]) && $i["name"] !== "unknown" && $i["name"] !== "fusion"; }))); } $ponies_cloudburst = ponies("ynmuc"); uasort($ponies_cloudburst, function ($a, $b) { return $b["_lastFronted"] - $a["_lastFronted"]; }); $ponies_cloudburst = array_filter($ponies_cloudburst, function ($i) { return $i["_lastFronted"] > 0; }); $ponies_raindrops = ponies("gdapd"); uasort($ponies_raindrops, function ($a, $b) { return $b["_lastFronted"] - $a["_lastFronted"]; }); $ponies_raindrops = array_filter($ponies_raindrops, function ($i) { return $i["_lastFronted"] > 0; }); $ponies_cloudburst = array_reverse($ponies_cloudburst); $ponies_raindrops = array_reverse($ponies_raindrops);