diff --git a/output/.gitkeep b/output/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/output/export_tags.md b/output/export_tags.md new file mode 100644 index 0000000..9c03e1c --- /dev/null +++ b/output/export_tags.md @@ -0,0 +1 @@ +# Export de Tags GTG du 02/03/2021 à 11:09:59 \ No newline at end of file diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index 3e187fd..e53ab65 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -51,7 +51,10 @@ button{ .text-right{ text-align: right; } - +.emphasis{ + font-weight: 700; + background: aquamarine; +} .proportion-over-95{ background: #b9ffbe; } diff --git a/routes/index.js b/routes/index.js index 8f8d766..15a3d15 100644 --- a/routes/index.js +++ b/routes/index.js @@ -41,6 +41,7 @@ router.get('/', async function (req, res, next) { } else { console.log('================== calcul de stats désactivé dans index.js ================== ') } + exportToMarkdown(res) console.log('json files read') res.render('index', { title: "Conversion de GTG tâches", @@ -69,6 +70,7 @@ function computeData(jsonAllData) { tasksCount : jsonAllData.tasks.project.task.length, tasksClosed: 0, tasksOpen : 0, + maxTasksCountPerTag : 0, listOpen : [], listClosed : [], } @@ -106,7 +108,11 @@ function computeData(jsonAllData) { elem.tasksListIsDoneByTitle.push(t.title) } } + if(elem.tasks > jsonAllData.stats.maxTasksCountPerTag){ + jsonAllData.stats.maxTasksCountPerTag = elem.tasks + } }) + } if (t.donedate) { jsonAllData.stats.tasksClosed++; @@ -165,11 +171,25 @@ function computeBgColorOnProportionOfOpenTasks(someProportionNumber) { result = 'proportion-over-15' } - console.log('result', someProportionNumber, result) return result; } -function exportToMarkdown() { +function exportToMarkdown(res) { + + let datenow = new Date(); + let dataTagsMd = '# Export de Tags GTG du '+ datenow.toLocaleString(); + // write file to disk + fs.writeFile('output/export_tags.md', dataTagsMd, 'utf8', (err) => { + + if (err) { + console.log(`Error writing file: ${err}`); + res.send(err) + } else { + console.log(`File \`output/export_tags.md\` is written successfully!`); + + } + + }); } diff --git a/views/index.jade b/views/index.jade index 45ecac4..aa721f3 100644 --- a/views/index.jade +++ b/views/index.jade @@ -10,6 +10,7 @@ block content li #{json.stats.tasksClosed} fermées section.tags h2 #{json.tags.tagstore.tag.length} Tags + p maximum de #{json.stats.maxTasksCountPerTag} tâches pour un tag. ul.tags li.head span.name nom @@ -21,11 +22,11 @@ block content span.tasks actives % each t in json.tags.tagstore.tag li - span.name= t['$'].name + span.name(class= {emphasis: t.tasks == json.stats.maxTasksCountPerTag})= t['$'].name span.color= t['$'].color span.parent= t['$'].parent if t.tasksListIsDoneByTitle - span.text-right= t.tasks + span.text-right(class=computeBgColorOnProportionOfOpenTasks(getPercent(t.tasks, json.stats.maxTasksCountPerTag)))= t.tasks if t.tasksListIsDoneByTitle span.text-right.tasks= t.tasksListIsDoneByTitle.length if t.tasksListIsActiveByTitle