From 0e0e463114b052bb305cefa2aa845f40e1c12ddf Mon Sep 17 00:00:00 2001 From: Zakaria Mansouri Date: Sat, 5 Oct 2024 16:32:35 +0200 Subject: [PATCH] show more details about contributors --- api/src/contributor/repository.ts | 4 ++- api/src/contributor/types.ts | 3 ++ web/src/pages/team/index.tsx | 59 +++++++++++++++++++++++++++++-- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/api/src/contributor/repository.ts b/api/src/contributor/repository.ts index 15823e61..6906e3e2 100644 --- a/api/src/contributor/repository.ts +++ b/api/src/contributor/repository.ts @@ -50,7 +50,9 @@ export class ContributorRepository { ${contributorsTable.id}, ${contributorsTable.name}, ${contributorsTable.avatarUrl}, - sum(${contributorRepositoryRelationTable.score}) as ranking + sum(${contributorRepositoryRelationTable.score}) as total_contribution_score, + count(DISTINCT ${contributorRepositoryRelationTable.repositoryId}) as total_repository_count, + (sum(${contributorRepositoryRelationTable.score}) * count(DISTINCT ${contributorRepositoryRelationTable.repositoryId})) as ranking FROM ${contributorRepositoryRelationTable} JOIN diff --git a/api/src/contributor/types.ts b/api/src/contributor/types.ts index 85f15f8e..12cdbde8 100644 --- a/api/src/contributor/types.ts +++ b/api/src/contributor/types.ts @@ -5,6 +5,9 @@ export interface GetContributorsResponse extends GeneralResponse { contributors: Array< Pick & { ranking: number; + + totalContributionScore: number; + totalRepositoryCount: number; } >; } diff --git a/web/src/pages/team/index.tsx b/web/src/pages/team/index.tsx index 8d3df642..aede6380 100644 --- a/web/src/pages/team/index.tsx +++ b/web/src/pages/team/index.tsx @@ -46,15 +46,68 @@ export default function Page(): JSX.Element { {contributorsList.map((contributor, contributorIndex) => ( {contributor.name} - {contributor.name} +
+
+ {contributor.name} + {contributor.name} +
+
+
+ + + + + {contributor.totalContributionScore} +
+
+
+ {contributor.totalRepositoryCount} + + + + + +
+
+
))}