Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions components/result-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@ export function ResultDashboard({ user1, user2 }: Props) {
const getInsights = () => {
const insights: string[] = [];

const user1DisplayName = user1.name || user1.username;
const user2DisplayName = user2.name || user1.username;

if (user1.repoScore > user2.repoScore) {
insights.push(
t("insights.repo.leader", {
username: user1.username,
username: user1DisplayName,
score: user1.repoScore,
other: user2.repoScore,
})
);
} else if (user2.repoScore > user1.repoScore) {
insights.push(
t("insights.repo.leader", {
username: user2.username,
username: user2DisplayName,
score: user2.repoScore,
other: user1.repoScore,
})
Expand All @@ -67,15 +70,15 @@ export function ResultDashboard({ user1, user2 }: Props) {
if (user1.prScore > user2.prScore) {
insights.push(
t("insights.pr.leader", {
username: user1.username,
username: user1DisplayName,
score: user1.prScore,
other: user2.prScore,
})
);
} else if (user2.prScore > user1.prScore) {
insights.push(
t("insights.pr.leader", {
username: user2.username,
username: user2DisplayName,
score: user2.prScore,
other: user1.prScore,
})
Expand All @@ -85,9 +88,9 @@ export function ResultDashboard({ user1, user2 }: Props) {
}

if (user1.contributionScore > user2.contributionScore) {
insights.push(t("insights.contribution.leader", { username: user1.username }));
insights.push(t("insights.contribution.leader", { username: user1DisplayName }));
} else if (user2.contributionScore > user1.contributionScore) {
insights.push(t("insights.contribution.leader", { username: user2.username }));
insights.push(t("insights.contribution.leader", { username: user2DisplayName }));
} else {
insights.push(t("insights.equal.contribution"));
}
Expand Down
Loading