@@ -12,7 +12,7 @@ export async function queryGender(department: string) {
12
12
throw new Error ( `Env variable HIBOB_TOKEN_READ_STANDARD not configured` ) ;
13
13
}
14
14
15
- const res = await fetch ( 'https://api.hibob.com/v1/people?humanReadable=true ' , {
15
+ const res = await fetch ( 'https://api.hibob.com/v1/profiles ' , {
16
16
headers : {
17
17
'content-type' : 'application/json' ,
18
18
Authorization : `Basic ${ btoa ( `SERVICE-5772:${ process . env . HIBOB_TOKEN_READ_STANDARD } ` ) } ` ,
@@ -27,8 +27,8 @@ export async function queryGender(department: string) {
27
27
28
28
let employees = data . employees ;
29
29
30
- if ( department === 'Engineering' ) {
31
- employees = employees . filter ( ( employee ) => employee . work . department === 'Engineering' ) ;
30
+ if ( department ) {
31
+ employees = employees . filter ( ( employee ) => employee . work . department === department ) ;
32
32
}
33
33
34
34
return ( countWomen ( employees ) / employees . length ) * 100 ;
@@ -39,7 +39,7 @@ export async function queryGenderManagement() {
39
39
throw new Error ( `Env variable HIBOB_TOKEN_READ_STANDARD not configured` ) ;
40
40
}
41
41
42
- const res = await fetch ( 'https://api.hibob.com/v1/people?humanReadable=true ' , {
42
+ const res = await fetch ( 'https://api.hibob.com/v1/profiles ' , {
43
43
headers : {
44
44
'content-type' : 'application/json' ,
45
45
Authorization : `Basic ${ btoa ( `SERVICE-5772:${ process . env . HIBOB_TOKEN_READ_STANDARD } ` ) } ` ,
@@ -52,7 +52,7 @@ export async function queryGenderManagement() {
52
52
}
53
53
const data = await res . json ( ) ;
54
54
55
- const managers = data . employees . filter ( ( employee ) => employee . work . isManager === 'Yes' ) ;
55
+ const managers = data . employees . filter ( ( employee ) => employee . work . isManager === true ) ;
56
56
57
57
return ( countWomen ( managers ) / managers . length ) * 100 ;
58
58
}
0 commit comments