Skip to content

Commit

Permalink
Merge pull request #370 from significa/proposal-estimates-people
Browse files Browse the repository at this point in the history
feat: change proposal estimates to count unique team members
  • Loading branch information
nunopolonia authored Mar 26, 2024
2 parents 8613258 + ba2dc96 commit 5749893
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/proposals/proposal-estimates.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
import { formatter } from '$lib/utils/currency';
import { slide } from 'svelte/transition';
type PhaseTeamType = {
name: string;
role: string | undefined;
rateType: string;
rateValue: number;
duration: number;
}[];
export let data: ProposalEstimateEntryStoryblok[];
export let team: ProposalTeamEntryStoryblok[] | ProposalPackageTeamEntryStoryblok[];
export let discount: string | undefined;
Expand All @@ -30,6 +38,7 @@
);
return {
name: teamMember?.team_member.member.name,
role: teamMember?.role[0].title,
rateType: teamMember?.rate_type,
rateValue: +teamMember?.rate_value,
Expand Down Expand Up @@ -64,12 +73,20 @@
0
);
const totalTeam = [
...new Set(
enhancedPhases
.reduce((acc: PhaseTeamType, { team }) => [...acc, ...team], [])
.map((member) => member.name)
)
].length;
return {
color,
title,
totals: {
phases: enhancedPhases.length,
team: enhancedPhases.reduce((total, { team }) => (total += team.length), 0),
team: totalTeam,
cost: totalRate + (totalRate * totalPercentage) / 100,
duration: enhancedPhases.reduce((total, { duration }) => (total += duration), 0)
},
Expand Down

0 comments on commit 5749893

Please sign in to comment.