-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7kyuTheOfficeBoredomScore.js
52 lines (43 loc) · 1.33 KB
/
7kyuTheOfficeBoredomScore.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Every now and then people in the office moves teams or departments. Depending what people are doing with their time they can become more or less boring. Time to assess the current team.
// You will be provided with an object(staff) containing the staff names as keys, and the department they work in as values.
// Each department has a different boredom assessment score, as follows:
// accounts = 1
// finance = 2
// canteen = 10
// regulation = 3
// trading = 6
// change = 6
// IS = 8
// retail = 5
// cleaning = 4
// pissing about = 25
// Depending on the cumulative score of the team, return the appropriate sentiment:
// <=80: 'kill me now'
// < 100 & > 80: 'i can handle this'
// 100 or over: 'party time!!'
function boredom(staff) {
const boredomScores = {
accounts: 1,
finance: 2,
canteen: 10,
regulation: 3,
trading: 6,
change: 6,
IS: 8,
retail: 5,
cleaning: 4,
"pissing about": 25
};
let totalBoredomScore = 0;
for (const person in staff) {
const department = staff[person];
totalBoredomScore += boredomScores[department];
}
if (totalBoredomScore <= 80) {
return 'kill me now';
} else if (totalBoredomScore < 100) {
return 'i can handle this';
} else {
return 'party time!!';
}
}