Skip to content

Commit

Permalink
feat: change proposal estimates to count unique team members instead …
Browse files Browse the repository at this point in the history
…of team slots
  • Loading branch information
nunopolonia committed Mar 26, 2024
1 parent 8613258 commit ba2dc96
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 ba2dc96

Please sign in to comment.