File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
pages/copilot-opportunity-details/tabs/copilot-applications Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ const tableColumns: TableColumn<CopilotApplication>[] = [
35
35
propertyName : 'activeProjects' ,
36
36
type : 'text' ,
37
37
} ,
38
+ {
39
+ label : 'Past Projects' ,
40
+ propertyName : 'pastProjects' ,
41
+ type : 'text' ,
42
+ } ,
38
43
{
39
44
label : 'Status' ,
40
45
propertyName : 'status' ,
@@ -81,6 +86,7 @@ const CopilotApplications: FC<{
81
86
fulfilment : member ?. copilotFulfillment || 0 ,
82
87
handle : member ?. handle ,
83
88
opportunityStatus : props . opportunity . status ,
89
+ pastProjects : member ?. pastProjects || 0 ,
84
90
}
85
91
} )
86
92
. sort ( ( a , b ) => ( b . fulfilment || 0 ) - ( a . fulfilment || 0 ) ) : [ ] )
Original file line number Diff line number Diff line change @@ -12,13 +12,15 @@ interface Member {
12
12
COPILOT : {
13
13
activeProjects : number ,
14
14
fulfillment : number ,
15
+ projects : number ,
15
16
}
16
17
} [ ]
17
18
}
18
19
19
20
export interface FormattedMembers extends Member {
20
21
copilotFulfillment : number ,
21
22
activeProjects : number ,
23
+ pastProjects : number ;
22
24
}
23
25
24
26
export type MembersResponse = SWRResponse < FormattedMembers [ ] , FormattedMembers [ ] >
@@ -40,11 +42,16 @@ export const getMembersByUserIds = async (
40
42
)
41
43
}
42
44
43
- const membersFactory = ( members : Member [ ] ) : FormattedMembers [ ] => members . map ( member => ( {
44
- ...member ,
45
- activeProjects : member . stats ?. find ( item => item . COPILOT ?. activeProjects ) ?. COPILOT ?. activeProjects || 0 ,
46
- copilotFulfillment : member . stats ?. find ( item => item . COPILOT ?. fulfillment ) ?. COPILOT ?. fulfillment || 0 ,
47
- } ) )
45
+ const membersFactory = ( members : Member [ ] ) : FormattedMembers [ ] => members . map ( member => {
46
+ const copilotStats = member . stats ?. find ( item => item . COPILOT ) ?. COPILOT ?? { } as Member [ 'stats' ] [ 0 ] [ 'COPILOT' ]
47
+
48
+ return {
49
+ ...member ,
50
+ activeProjects : copilotStats . activeProjects || 0 ,
51
+ copilotFulfillment : copilotStats . fulfillment || 0 ,
52
+ pastProjects : copilotStats . projects || 0 ,
53
+ }
54
+ } )
48
55
49
56
/**
50
57
* Custom hook to fetch members by list of user ids
You can’t perform that action at this time.
0 commit comments