calcul stats
This commit is contained in:
parent
c7a04bc8d8
commit
8a6b6078c7
@ -19,3 +19,9 @@ li:nth-of-type(odd){
|
||||
display: inline-block;
|
||||
min-width : 10em;
|
||||
}
|
||||
|
||||
tag{
|
||||
background : #00B7FF;
|
||||
padding: 0.5em;
|
||||
border-radius: 0.15em;
|
||||
}
|
||||
|
@ -58,9 +58,56 @@ function computeData(jsonAllData){
|
||||
// et rajouter ce nombre à chaque tag, dans countTasks : N
|
||||
// let tagCountTasks = Object.create(jsonAllData.tags);
|
||||
|
||||
jsonAllData.stats = {
|
||||
tasksCount : jsonAllData.tasks.project.task.length,
|
||||
tasksClosed : 0,
|
||||
tasksOpen : 0,
|
||||
listOpen: [],
|
||||
listClosed: [],
|
||||
}
|
||||
|
||||
for(let t of jsonAllData.tasks.project.task ) {
|
||||
console.log('t', t)
|
||||
let tags = t["$"].tags
|
||||
// console.log('t', t)
|
||||
let tags = t["$"].tags.split(',')
|
||||
for(let tag of tags){
|
||||
// console.log('tag', tag)
|
||||
jsonAllData.tags.tagstore.tag.map( elem =>{
|
||||
// console.log('elem', elem)
|
||||
if(elem['$'].name == tag){
|
||||
if(!elem.tasks){
|
||||
elem.tasks = 0
|
||||
}
|
||||
if(!elem.tasksListById){
|
||||
elem.tasksListById = []
|
||||
}
|
||||
if(!elem.tasksListByTitle){
|
||||
elem.tasksListByTitle = []
|
||||
}
|
||||
if(!elem.tasksListIsActiveByTitle){
|
||||
elem.tasksListIsActiveByTitle = []
|
||||
}
|
||||
if(!elem.tasksListIsDoneByTitle){
|
||||
elem.tasksListIsDoneByTitle = []
|
||||
}
|
||||
elem.tasks++
|
||||
elem.tasksListById.push(t['$'].id)
|
||||
elem.tasksListByTitle.push(t.title)
|
||||
if(t['$'].status == "Active"){
|
||||
elem.tasksListIsActiveByTitle.push(t.title)
|
||||
}
|
||||
if(t['$'].status == "Done"){
|
||||
elem.tasksListIsDoneByTitle.push(t.title)
|
||||
}
|
||||
}
|
||||
})
|
||||
// found.tasks++
|
||||
}
|
||||
if(t.donedate){
|
||||
jsonAllData.stats.tasksClosed++;
|
||||
jsonAllData.stats.listOpen.push(t);
|
||||
}else{
|
||||
jsonAllData.stats.tasksOpen++;
|
||||
}
|
||||
// console.log('tags', tags)
|
||||
}
|
||||
return jsonAllData
|
||||
|
@ -5,6 +5,9 @@ block content
|
||||
p Welcome to #{title}
|
||||
section.tasks
|
||||
h2 #{json.tasks.project.task.length} Tâches
|
||||
ul.stats
|
||||
li #{json.stats.tasksOpen} ouvertes
|
||||
li #{json.stats.tasksClosed} fermées
|
||||
section.tags
|
||||
h2 #{json.tags.tagstore.tag.length} Tags
|
||||
ul.tags
|
||||
@ -13,8 +16,15 @@ block content
|
||||
span.color couleur
|
||||
span.parent parent
|
||||
span.tasks tâches
|
||||
span.tasks actives
|
||||
span.tasks finies
|
||||
each t in json.tags.tagstore.tag
|
||||
li
|
||||
span.name= t['$'].name
|
||||
span.color= t['$'].color
|
||||
span.parent= t['$'].parent
|
||||
span.tasks= t.tasks
|
||||
if t.tasksListIsActiveByTitle
|
||||
span.tasks= t.tasksListIsActiveByTitle.length
|
||||
if t.tasksListIsDoneByTitle
|
||||
span.tasks= t.tasksListIsDoneByTitle.length
|
||||
|
Loading…
Reference in New Issue
Block a user