diff --git a/controller/action/ContentActions.class.php b/controller/action/ContentActions.class.php index 34c22016..95d3884f 100644 --- a/controller/action/ContentActions.class.php +++ b/controller/action/ContentActions.class.php @@ -220,9 +220,9 @@ class ContentActions extends Actions { $lastItem = end($items); $project = $lastItem['project']; - if (!isset($projectMaxVersions[$project]) || strnatcasecmp($lastItem['version'], $projectMaxVersions[$project]) > 0) + if (!isset($projectMaxVersions[$project]) || $lastItem['sort_key'] > $projectMaxVersions[$project]) { - $projectMaxVersions[$project] = $lastItem['version']; + $projectMaxVersions[$project] = $lastItem['sort_key']; } } } diff --git a/lib/thirdparty/Asana.class.php b/lib/thirdparty/Asana.class.php index 3ce983b3..2032d930 100644 --- a/lib/thirdparty/Asana.class.php +++ b/lib/thirdparty/Asana.class.php @@ -19,7 +19,7 @@ class Asana $tasks = []; $tags = [ - 192699565737944 => 'Ongoing', + 192699565737944 => 'Open Beta', 192699565737946 => 'Upcoming', 192699565737948 => 'Future' ]; @@ -40,12 +40,14 @@ class Asana else { $projectName = 'Other'; + $projectId = null; } $tasks[$tagLabel][] = array_intersect_key($fullTask, ['name' => null]) + [ 'badge' => $projectName, 'date' => $fullTask['due_on'] ?? null, - 'body' => nl2br($fullTask['notes']) , + 'body' => nl2br($fullTask['notes']), 'group' => $tagLabel, + 'project_id' => $projectId, 'assignee' => $fullTask['assignee'] ? ucwords($fullTask['assignee']['name']) : '' ]; } @@ -64,6 +66,10 @@ class Asana { return $tA['date'] ? -1 : 1; } + if ($tA['project_id'] xor $tB['project_id']) + { + return $tA['project_id'] ? -1 : 1; + } return $tA['date'] < $tB['date'] ? -1 : 1; }); } diff --git a/lib/thirdparty/Github.class.php b/lib/thirdparty/Github.class.php index 848040c7..61cc9dfa 100644 --- a/lib/thirdparty/Github.class.php +++ b/lib/thirdparty/Github.class.php @@ -106,21 +106,24 @@ class Github $sets = []; $allReleases = []; - $project = 'lbry'; - $page = 1; + $projects = ['lbry' => 'Daemon', 'lbry-app' => 'App']; - do + foreach($projects as $project => $projectLabel) { - $releases = static::get('/repos/lbryio/' . $project . '/releases?page=' . $page, $cache); - $page++; - $allReleases = array_merge($allReleases, array_map(function ($release) use ($project) + $page = 1; + do { - return $release + ['project' => $project]; - }, array_filter($releases, function ($release) - { - return ($release['tag_name'] ?? null) && ($release['published_at'] ?? null) && !$release['prerelease']; - }))); - } while (count($releases) >= 30); + $releases = static::get('/repos/lbryio/' . $project . '/releases?page=' . $page, $cache); + $page++; + $allReleases = array_merge($allReleases, array_map(function ($release) use ($project, $projectLabel) + { + return $release + ['project' => $projectLabel]; + }, array_filter($releases, function ($release) + { + return isset($release['tag_name']) && isset($release['published_at']) && $release['published_at']; + }))); + } while (count($releases) >= 30); + } foreach ($allReleases as $release) { @@ -128,23 +131,36 @@ class Github $matches = null; if (preg_match('/^v(\d+)\.(\d+)\./', $release['tag_name'] ?? '', $matches)) { - $group = 'v' . $matches[1] . '.' . $matches[2]; + $group = $release['project'] . ' v' . $matches[1] . '.' . $matches[2]; } if ($group) { - $sets[$group][] = [ - 'project' => $release['project'], - 'date' => date('Y-m-d', strtotime($release['created_at'])), - 'created_at' => $release['created_at'], - 'name' => $release['name'] ?: $release['tag_name'], - 'url' => $release['html_url'], - 'version' => $release['tag_name'], - 'body' => ParsedownExtra::instance()->text($release['body']) - ]; + $sets[$group][] = array_intersect_key($release, [ + 'prerelease' => null, 'tag_name' => null, 'published_at' => null, 'project' => null + ]) + [ + 'date' => date('Y-m-d', strtotime($release['created_at'])), + //I thought published_at, but GitHub displays created_at and published_at is out of sync sometimes (0.3.2, 0.3.3) + 'name' => $release['name'] ?: $release['tag_name'], + 'url' => $release['html_url'], + 'major_version' => (int)$matches[1], + 'minor_version' => (int)$matches[2], + 'patch_version' => (int)isset($matches[3]) ? $matches[3] : 0, + 'sort_key' => (int)$matches[1] * 1000000 + (int)$matches[2] * 1000 + (int)($matches[3] ?? 0), + 'version' => $matches[1] . '.' . $matches[2] . '.' . (isset($matches[3]) ? $matches[3] : ''), + 'body' => ParsedownExtra::instance()->text($release['body']) + ]; } } - uasort($sets, function ($sA, $sB) { return $sA[0]['created_at'] <=> $sB[0]['created_at']; }); + uasort($sets, function ($sA, $sB) + { + if ($sA[0]['project'] != $sB[0]['project']) + { + return $sA[0]['project'] < $sB[0]['project'] ? -1 : 1; + } + return $sA[0]['sort_key'] < $sB[0]['sort_key'] ? -1 : 1; + }); + foreach ($sets as $group => &$groupSet) { usort($groupSet, function ($rA, $rB) { return $rA['created_at'] <=> $rB['created_at']; }); diff --git a/view/template/content/roadmap.php b/view/template/content/roadmap.php index 9215a672..d2a07c53 100644 --- a/view/template/content/roadmap.php +++ b/view/template/content/roadmap.php @@ -29,15 +29,15 @@
$groupItems): ?> - +