Story 4.1: page competences

This commit is contained in:
2026-02-04 17:26:58 +01:00
parent 56b9dad29e
commit 485e3103c5
5 changed files with 135 additions and 31 deletions

View File

@@ -107,4 +107,31 @@ function projectImage(string $filename, string $alt, int $width, int $height, bo
>
</picture>
HTML;
}
/**
* Compte les projets par technologie
*/
function getProjectCountByTech(): array
{
$projects = getProjects();
$count = [];
foreach ($projects as $project) {
foreach ($project['technologies'] ?? [] as $tech) {
$count[$tech] = ($count[$tech] ?? 0) + 1;
}
}
return $count;
}
/**
* Récupère les projets utilisant une technologie
*/
function getProjectsByTech(string $tech): array
{
return array_values(array_filter(getProjects(), function ($project) use ($tech) {
return in_array($tech, $project['technologies'] ?? [], true);
}));
}