listing show button, fix percent count

This commit is contained in:
Tykayn 2021-03-02 10:12:15 +01:00 committed by tykayn
parent 8a6b6078c7
commit a48013b752
3 changed files with 32 additions and 7 deletions

View File

@ -25,3 +25,17 @@ tag{
padding: 0.5em; padding: 0.5em;
border-radius: 0.15em; border-radius: 0.15em;
} }
.toggle + ul{
height: 0;
visibility: collapse;
}
.toggle:focus + ul{
height: 100%;
transition: all ease 0.5s;
visibility: visible;
}
.task_item{
padding: 0.5em;
margin-left: 1em;
}

View File

@ -6,8 +6,8 @@ var router = express.Router();
var fileToOpen = 'gtg_tasks' var fileToOpen = 'gtg_tasks'
// const convertFiles = true; // const convertFiles = true;
const convertFiles = false; let convertFiles = false;
const computeDataOnExtract = true; let computeDataOnExtract = true;
let jsonAllData = { let jsonAllData = {
tasks : {}, tasks : {},
@ -37,11 +37,14 @@ router.get('/', async function (req, res, next) {
if(computeDataOnExtract){ if(computeDataOnExtract){
jsonAllData = computeData(jsonAllData) jsonAllData = computeData(jsonAllData)
computeDataOnExtract =false;
}else{ }else{
console.log('================== calcul de stats désactivé dans index.js ================== ') console.log('================== calcul de stats désactivé dans index.js ================== ')
} }
console.log('json files read' ) console.log('json files read' )
res.render('index', {title: "Conversion de GTG tâches", json: jsonAllData}) res.render('index', {title: "Conversion de GTG tâches",
json: jsonAllData,
getPercentOfOpenTasks})
}); });
async function readfileJson(fileToOpen){ async function readfileJson(fileToOpen){
@ -100,7 +103,6 @@ function computeData(jsonAllData){
} }
} }
}) })
// found.tasks++
} }
if(t.donedate){ if(t.donedate){
jsonAllData.stats.tasksClosed++; jsonAllData.stats.tasksClosed++;
@ -122,6 +124,9 @@ function convertOneXmlToJson(fileToOpen,res){
}); });
} }
function getPercentOfOpenTasks(someCount){
return Math.round( 100*someCount / jsonAllData.stats.tasksOpen)
}
function transformToJson(xml,fileToOpen, res) { function transformToJson(xml,fileToOpen, res) {
return parseString(xml, function (err, result) { return parseString(xml, function (err, result) {
if (err) console.log(err); if (err) console.log(err);

View File

@ -16,15 +16,21 @@ 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 span.tasks finies
span.tasks actives
span.tasks actives %
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 span.tasks= t.tasks
if t.tasksListIsActiveByTitle
span.tasks= t.tasksListIsActiveByTitle.length
if t.tasksListIsDoneByTitle if t.tasksListIsDoneByTitle
span.tasks= t.tasksListIsDoneByTitle.length span.tasks= t.tasksListIsDoneByTitle.length
if t.tasksListIsActiveByTitle
span.tasks #{t.tasksListIsActiveByTitle.length}
span.tasks #{getPercentOfOpenTasks(t.tasksListIsActiveByTitle.length)} %
button.toggle voir
ul
each activetask in t.tasksListIsActiveByTitle
li.task_item= activetask