Created
April 27, 2020 16:41
-
-
Save paitonic/a217ad6d4b12711dc01ee3c8945e8fdc to your computer and use it in GitHub Desktop.
doGoodEstimate.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const GOOD_OVERALL_EFFORT_DAYS = 30; | |
| const MAX_DAYS_PER_TASK = 4 | |
| const doGoodEstimate = (tasks) => { | |
| let estimated = tasks.map((task) => { | |
| task.effort = Math.floor((Math.random() * MAX_DAYS_PER_TASK) + 1); | |
| return task; | |
| }); | |
| const totalEffort = estimated.reduce((sum, task) => { | |
| return sum + task.effort; | |
| }, 0); | |
| if (totalEffort > GOOD_OVERALL_EFFORT_DAYS) { | |
| estimated = doGoodEstimate(estimated); | |
| } | |
| return estimated; | |
| } | |
| doGoodEstimate(tasks); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment