calcul stats
This commit is contained in:
parent
c7a04bc8d8
commit
8a6b6078c7
@ -19,3 +19,9 @@ li:nth-of-type(odd){
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
min-width : 10em;
|
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
|
// et rajouter ce nombre à chaque tag, dans countTasks : N
|
||||||
// let tagCountTasks = Object.create(jsonAllData.tags);
|
// 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 ) {
|
for(let t of jsonAllData.tasks.project.task ) {
|
||||||
console.log('t', t)
|
// console.log('t', t)
|
||||||
let tags = t["$"].tags
|
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)
|
// console.log('tags', tags)
|
||||||
}
|
}
|
||||||
return jsonAllData
|
return jsonAllData
|
||||||
|
@ -5,6 +5,9 @@ block content
|
|||||||
p Welcome to #{title}
|
p Welcome to #{title}
|
||||||
section.tasks
|
section.tasks
|
||||||
h2 #{json.tasks.project.task.length} Tâches
|
h2 #{json.tasks.project.task.length} Tâches
|
||||||
|
ul.stats
|
||||||
|
li #{json.stats.tasksOpen} ouvertes
|
||||||
|
li #{json.stats.tasksClosed} fermées
|
||||||
section.tags
|
section.tags
|
||||||
h2 #{json.tags.tagstore.tag.length} Tags
|
h2 #{json.tags.tagstore.tag.length} Tags
|
||||||
ul.tags
|
ul.tags
|
||||||
@ -13,8 +16,15 @@ block content
|
|||||||
span.color couleur
|
span.color couleur
|
||||||
span.parent parent
|
span.parent parent
|
||||||
span.tasks tâches
|
span.tasks tâches
|
||||||
|
span.tasks actives
|
||||||
|
span.tasks finies
|
||||||
each t in json.tags.tagstore.tag
|
each t in json.tags.tagstore.tag
|
||||||
li
|
li
|
||||||
span.name= t['$'].name
|
span.name= t['$'].name
|
||||||
span.color= t['$'].color
|
span.color= t['$'].color
|
||||||
span.parent= t['$'].parent
|
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