Add function to get count of completed tasks

This commit is contained in:
Raimund Schlüßler 2018-09-23 15:36:18 +02:00
parent 7963f05c09
commit bf7c4d8c24
No known key found for this signature in database
GPG key ID: 036FA7EB1A599178

View file

@ -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
*