Sort projects in seed view by most recent activity

Uses the projects activity, fetched from `/projects/${id}/activity`
which is an array of commit timestamps.
So could suffer from some errors if commits with non current timestamps
are being used.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2023-07-31 13:05:56 +02:00
committed by Rūdolfs Ošiņš
parent 99ec07e0a3
commit f4bf5b9c6a
2 changed files with 5 additions and 18 deletions
+5 -1
View File
@@ -58,10 +58,14 @@ export async function loadProjects(
};
}),
);
// Sorts projects by most recent commit descending.
const sortedProjects = results.sort(
(a, b) => b.activity[0].time - a.activity[0].time,
);
return {
total: nodeStats.projects.count,
projects: results,
projects: sortedProjects,
};
}