Advertisement
Guest User

Untitled

a guest
May 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. let effort = 0;
  2. const standard = 37;
  3. const potential = 45;
  4. const diff = potential - standard;
  5. const week = [
  6. {
  7. id: "monday",
  8. standard: 8,
  9. extra: 11,
  10. GoTFactor: 2,
  11. },
  12. {
  13. id: "tuesday",
  14. standard: 8,
  15. extra: 8,
  16. GoTFactor: 1,
  17. }
  18. ]
  19.  
  20. week.forEach( (day) => {
  21. const maximumEffort = day.extra - day.GoTFactor;
  22. let warning = `Keep up the good work, you have done ${maximumEffort} hours extra this ${day.id}`;
  23.  
  24. if ( maximumEffort > diff ) {
  25. const effortLeak = maximumEffort - diff;
  26. warning = `Dood.. you have worked ${effortLeak} hour/s more than what the bossman wanted for an entire week.. the ask is only ${diff} more hours than a usual week, but you have blown though that on a ${day.id}`;
  27. }
  28.  
  29. if(day.GoTFactor > 0) {
  30. warning = warning.concat(`... And thats inspite of you watching/rambling Game of Thrones for ${day.GoTFactor} hour/s`);
  31. }
  32.  
  33. effort = effort + maximumEffort;
  34. warning = warning.concat(`... This brings your total weekly overtime effort up to ${effort}`);
  35.  
  36. console.log(warning);
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement