Last active
April 3, 2018 15:58
-
-
Save RobertFischer/6aa3e21cd7e15846f4e1e7d54c9fe758 to your computer and use it in GitHub Desktop.
Task Completion Calculation
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 {taskArray,completeTasks} = this.props; // These are both arrays of task ids (and nothing else) | |
const totalTaskSize = _.size(taskArray); | |
const completeTaskSize = _.size(_.intersection(taskArray, completeTasks)) // https://lodash.com/docs/4.17.5#intersection | |
const pctComplete = (completeTaskSize*1.0)/(totalTaskSize*1.0); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment