Add function to get count of completed tasks
This commit is contained in:
parent
7963f05c09
commit
bf7c4d8c24
1 changed files with 16 additions and 0 deletions
16
src/store.js
16
src/store.js
|
@ -94,6 +94,22 @@ export default new Vuex.Store({
|
|||
return count
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the count of tasks in a calendar
|
||||
*
|
||||
* Tasks have to be
|
||||
* - a root task
|
||||
* - completed
|
||||
*
|
||||
* @param {String} calendarId the Id of the calendar in question
|
||||
*/
|
||||
getCalendarCountCompleted: state => (calendarId) => {
|
||||
return Object.values(state.calendars[calendarId].tasks)
|
||||
.filter(task => {
|
||||
return task.completed === true && !task.related
|
||||
}).length
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns if a calendar name is already used by an other calendar
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue