Compare commits
No commits in common. "698c01ac07b36ea2140ff745008ab0d0f91ed78d" and "42c92e6047a224c423222fbf1a6b8428064233ca" have entirely different histories.
698c01ac07
...
42c92e6047
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,3 @@ sources/
|
|||||||
.idea
|
.idea
|
||||||
node_modules
|
node_modules
|
||||||
output/
|
output/
|
||||||
output/*
|
|
||||||
|
3
app.js
3
app.js
@ -43,8 +43,7 @@ const port = 3300
|
|||||||
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`gtg2json app listening at http://localhost:${port}`)
|
console.log(`Example app listening at http://localhost:${port}`)
|
||||||
console.log(`convert your Getting things gnomes files at http://localhost:${port}/xml`)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo " _____ convert the markdown on output with pandoc ____"
|
|
||||||
|
|
||||||
pandoc output/export_hebdo.md -t html -s -o output/export_hebdo.html
|
|
||||||
pandoc output/export_tags.md -t html -s -o output/export_tags.html
|
|
||||||
pandoc output/export_all.md -t html -s -o output/export_all.html
|
|
||||||
ls -larth output/*.html
|
|
||||||
|
|
||||||
echo " _____ ok files converted to html ____"
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo " _____ import files from ~/.var/app/org.gnome.GTG/data/gtg ____"
|
|
||||||
|
|
||||||
cp ~/.var/app/org.gnome.GTG/data/gtg/*.xml ./sources
|
|
||||||
|
|
||||||
ls -larth sources/*.xml
|
|
||||||
|
|
||||||
echo " _____ ok files imported ____"
|
|
||||||
echo " _____ you can convert with running 'node app.js' ____"
|
|
||||||
echo " _____ and open http://localhost:3300/ ____"
|
|
124
routes/index.js
124
routes/index.js
@ -8,7 +8,6 @@ var router = express.Router();
|
|||||||
let convertFiles = true;
|
let convertFiles = true;
|
||||||
// let convertFiles = false;
|
// let convertFiles = false;
|
||||||
let computeDataOnExtract = true;
|
let computeDataOnExtract = true;
|
||||||
// let computeDataOnExtract = false;
|
|
||||||
|
|
||||||
let jsonAllData = {
|
let jsonAllData = {
|
||||||
tasks : {},
|
tasks : {},
|
||||||
@ -20,32 +19,20 @@ let jsonAllData = {
|
|||||||
/**
|
/**
|
||||||
* obtenir la liste de tags que l'on a entré
|
* obtenir la liste de tags que l'on a entré
|
||||||
*/
|
*/
|
||||||
router.get('/xml', async function (req, res, next) {
|
|
||||||
fs.stat('sources/gtg_tasks.xml', function(err, stat) {
|
|
||||||
if(err == null) {
|
|
||||||
console.log('File sources/gtg_tasks.xml exists');
|
|
||||||
} else if(err.code === 'ENOENT') {
|
|
||||||
// file does not exist
|
|
||||||
res.send('le fichier sources/gtg_tasks.xml est introuvable. Impossible d en extraire des infos. Importez d abord les fichiers de données xml de Getting Things Gnome dans le dossier sources')
|
|
||||||
} else {
|
|
||||||
console.log('Some other error: ', err.code);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
convertOneXmlToJson('gtg_tasks', res)
|
|
||||||
convertOneXmlToJson('tags', res)
|
|
||||||
convertOneXmlToJson('projects', res)
|
|
||||||
console.log('success conversion xml')
|
|
||||||
res.redirect('/')
|
|
||||||
})
|
|
||||||
router.get('/', async function (req, res, next) {
|
router.get('/', async function (req, res, next) {
|
||||||
|
|
||||||
|
if (convertFiles) {
|
||||||
|
|
||||||
|
convertOneXmlToJson('gtg_tasks', res)
|
||||||
|
convertOneXmlToJson('tags', res)
|
||||||
|
convertOneXmlToJson('projects', res)
|
||||||
|
} else {
|
||||||
|
console.log('================== conversion de fichiers désactivée dans index.js ================== ')
|
||||||
|
}
|
||||||
|
|
||||||
// récupérer le contenu des json
|
// récupérer le contenu des json
|
||||||
jsonAllData.tags = require('../sources/tags_gtg.json')
|
jsonAllData.tags = require('../sources/tags_gtg.json')
|
||||||
jsonAllData.tasks = require('../sources/gtg_tasks_gtg.json')
|
jsonAllData.tasks = require('../sources/gtg_tasks_gtg.json')
|
||||||
if(!jsonAllData.tasks){
|
|
||||||
res.redirect('/xml')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (computeDataOnExtract) {
|
if (computeDataOnExtract) {
|
||||||
|
|
||||||
@ -59,8 +46,6 @@ router.get('/', async function (req, res, next) {
|
|||||||
res.render('index', {
|
res.render('index', {
|
||||||
title: "Conversion de GTG tâches",
|
title: "Conversion de GTG tâches",
|
||||||
json : jsonAllData,
|
json : jsonAllData,
|
||||||
markdown : markdownExportData,
|
|
||||||
weeklyDevReport,
|
|
||||||
getPercent,
|
getPercent,
|
||||||
computeBgColorOnProportionOfOpenTasks,
|
computeBgColorOnProportionOfOpenTasks,
|
||||||
getPercentOfOpenTasks
|
getPercentOfOpenTasks
|
||||||
@ -223,56 +208,49 @@ function computeBgColorOnProportionOfOpenTasks(someProportionNumber) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
let datenow = new Date();
|
let datenow = new Date();
|
||||||
let markdownExportData = ''
|
let dataTagsMd = `# Export de Tâches GTG \n date: ` + datenow.toLocaleString()
|
||||||
let weeklyDevReport = ''
|
|
||||||
function exportToMarkdown(res) {
|
function exportToMarkdown(res) {
|
||||||
|
|
||||||
|
|
||||||
markdownExportData = `# Export de Tâches GTG \n date: ` + datenow.toLocaleString()
|
|
||||||
// fichier de rapport des tâches fermées durant les 7 derniers jours
|
// fichier de rapport des tâches fermées durant les 7 derniers jours
|
||||||
weeklyDevReport += `\n# Rapport hebdomadaire de dev `;
|
dataTagsMd += `\n# Rapport hebdomadaire de dev `;
|
||||||
weeklyDevReport += `\r\n## ${jsonAllData.stats.listDevWeeklyClosed.length} ont été fermées `;
|
dataTagsMd += `\n## ${jsonAllData.stats.listDevWeeklyClosed.length} ont été fermées `;
|
||||||
jsonAllData.stats.listDevWeeklyClosed.map(elem => {
|
jsonAllData.stats.listDevWeeklyClosed.map(elem => {
|
||||||
weeklyDevReport += `\n* ${elem.title}`;
|
dataTagsMd += `\n * ${elem.title}`;
|
||||||
})
|
})
|
||||||
markdownExportData += `\n ${weeklyDevReport}`;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n---`;
|
dataTagsMd += `\n---`;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n# Rapport des tâches durant les 7 derniers jours `;
|
dataTagsMd += `\n# Rapport des tâches durant les 7 derniers jours `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n## ${jsonAllData.stats.listClosedWeekly.length} ont été fermées `;
|
dataTagsMd += `\n## ${jsonAllData.stats.listClosedWeekly.length} ont été fermées `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
jsonAllData.stats.listClosedWeekly.map(elem => {
|
jsonAllData.stats.listClosedWeekly.map(elem => {
|
||||||
markdownExportData += `\n * ${elem.title}`;
|
dataTagsMd += `\n * ${elem.title}`;
|
||||||
})
|
})
|
||||||
markdownExportData += `\n## ${jsonAllData.stats.listOpenWeekly.length} ont été ouvertes `;
|
dataTagsMd += `\n## ${jsonAllData.stats.listOpenWeekly.length} ont été ouvertes `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
jsonAllData.stats.listOpenWeekly.map(elem => {
|
jsonAllData.stats.listOpenWeekly.map(elem => {
|
||||||
markdownExportData += `\n * ${elem.title}`;
|
dataTagsMd += `\n * ${elem.title}`;
|
||||||
})
|
})
|
||||||
markdownExportData += `\n--- `;
|
dataTagsMd += `\n--- `;
|
||||||
// fichier de rapport des tâches fermées durant les 31 derniers jours
|
// fichier de rapport des tâches fermées durant les 31 derniers jours
|
||||||
markdownExportData += `\n# Rapport des autres tâches durant le mois `;
|
dataTagsMd += `\n# Rapport des autres tâches durant le mois `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n## ${jsonAllData.stats.listClosedMonthly.length} ont été fermées `;
|
dataTagsMd += `\n## ${jsonAllData.stats.listClosedWeekly.length} ont été fermées `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
jsonAllData.stats.listClosedMonthly.map(elem => {
|
|
||||||
markdownExportData += `\n * ${elem.title}`;
|
|
||||||
})
|
|
||||||
markdownExportData += `\n## ${jsonAllData.stats.listOpenMonthly.length} ont été ouvertes `;
|
|
||||||
markdownExportData += `\n `;
|
|
||||||
jsonAllData.stats.listOpenMonthly.map(elem => {
|
|
||||||
markdownExportData += `\n * ${elem.title}`;
|
|
||||||
})
|
|
||||||
|
|
||||||
markdownExportData += `\n--- `;
|
dataTagsMd += `\n## ${jsonAllData.stats.listOpenWeekly.length} ont été ouvertes `;
|
||||||
|
dataTagsMd += `\n `;
|
||||||
|
dataTagsMd += `\n--- `;
|
||||||
// stats de fermeture des tâches
|
// stats de fermeture des tâches
|
||||||
markdownExportData += `\n# Stats de fermeture des tâches `;
|
dataTagsMd += `\n# Stats de fermeture des tâches `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n--- `;
|
dataTagsMd += `\n--- `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n# Export de toutes les ${jsonAllData.stats.listOpen.length} tâches ouvertes GTG \n `;
|
dataTagsMd += `\n# Export de toutes les ${jsonAllData.stats.listOpen.length} tâches ouvertes GTG \n `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
|
|
||||||
// jsonAllData.stats.listOpen.map(elem => {
|
// jsonAllData.stats.listOpen.map(elem => {
|
||||||
// dataTagsMd += `\n## ${elem.title} `;
|
// dataTagsMd += `\n## ${elem.title} `;
|
||||||
@ -282,32 +260,32 @@ function exportToMarkdown(res) {
|
|||||||
// dataTagsMd += `\n prévu pour : ${elem.duedate | ''} `;
|
// dataTagsMd += `\n prévu pour : ${elem.duedate | ''} `;
|
||||||
// dataTagsMd += `\n ${elem.content} `;
|
// dataTagsMd += `\n ${elem.content} `;
|
||||||
// })
|
// })
|
||||||
markdownExportData += `\n--- `;
|
dataTagsMd += `\n--- `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n# Export de toutes les ${jsonAllData.stats.listClosed.length} tâches fermées GTG \n `;
|
dataTagsMd += `\n# Export de toutes les ${jsonAllData.stats.listClosed.length} tâches fermées GTG \n `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
//
|
//
|
||||||
// jsonAllData.stats.listClosed.map(elem=>{
|
// jsonAllData.stats.listClosed.map(elem=>{
|
||||||
// dataTagsMd += `\n * ${elem.title} `;
|
// dataTagsMd += `\n * ${elem.title} `;
|
||||||
// })
|
// })
|
||||||
|
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n# Export de Tags GTG \n `;
|
dataTagsMd += `\n# Export de Tags GTG \n `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
|
|
||||||
let sortedTagsByTitle = _.sortBy(jsonAllData.tags.tagstore.tag, [(o) => {
|
let sortedTagsByTitle = _.sortBy(jsonAllData.tags.tagstore.tag, [(o) => {
|
||||||
o["$"].name
|
o["$"].name
|
||||||
}])
|
}])
|
||||||
|
|
||||||
sortedTagsByTitle.map(elem => {
|
sortedTagsByTitle.map(elem => {
|
||||||
markdownExportData += `\n * ${elem['$'].name} , ${elem.tasks | 0}`;
|
dataTagsMd += `\n * ${elem['$'].name} , ${elem.tasks | 0}`;
|
||||||
})
|
})
|
||||||
|
|
||||||
markdownExportData += `\n `;
|
dataTagsMd += `\n `;
|
||||||
markdownExportData += `\n rapport généré avec gtg2nodejs par tykayn - contact@cipherbliss.com `;
|
dataTagsMd += `\n rapport généré avec gtg2nodejs par tykayn - contact@cipherbliss.com `;
|
||||||
// write file to disk
|
// write file to disk
|
||||||
fs.writeFile(`output/export_hebdo.md`, markdownExportData, `utf8`, (err) => {
|
fs.writeFile(`output/export_tags.md`, dataTagsMd, `utf8`, (err) => {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(`Error writing file: ${err}`);
|
console.log(`Error writing file: ${err}`);
|
||||||
|
@ -12,9 +12,6 @@ block content
|
|||||||
li #{json.stats.listClosed.length} fermées
|
li #{json.stats.listClosed.length} fermées
|
||||||
li #{json.stats.listClosedWeekly.length} fermées cette semaine
|
li #{json.stats.listClosedWeekly.length} fermées cette semaine
|
||||||
li #{json.stats.listClosedMonthly.length} fermées ce mois-ci
|
li #{json.stats.listClosedMonthly.length} fermées ce mois-ci
|
||||||
section.markdown
|
|
||||||
h2 Rapport de dev de la semaine
|
|
||||||
article(language="md")= weeklyDevReport
|
|
||||||
section.tags
|
section.tags
|
||||||
h2 #{json.tags.tagstore.tag.length} Tags
|
h2 #{json.tags.tagstore.tag.length} Tags
|
||||||
p maximum de #{json.stats.maxTasksCountPerTag} tâches pour un tag.
|
p maximum de #{json.stats.maxTasksCountPerTag} tâches pour un tag.
|
||||||
@ -39,7 +36,7 @@ block content
|
|||||||
if t.tasksListIsActiveByTitle
|
if t.tasksListIsActiveByTitle
|
||||||
span.text-right.tasks #{t.tasksListIsActiveByTitle.length}
|
span.text-right.tasks #{t.tasksListIsActiveByTitle.length}
|
||||||
span.text-right.tasks(class=computeBgColorOnProportionOfOpenTasks(getPercent(t.tasksListIsActiveByTitle.length, t.tasks))) #{getPercent(t.tasksListIsActiveByTitle.length, t.tasks)} %
|
span.text-right.tasks(class=computeBgColorOnProportionOfOpenTasks(getPercent(t.tasksListIsActiveByTitle.length, t.tasks))) #{getPercent(t.tasksListIsActiveByTitle.length, t.tasks)} %
|
||||||
span.text-right.tasks #{getPercent(t.tasksListIsActiveByTitle.length,json.stats.listOpen.length )} %
|
span.text-right.tasks #{getPercentOfOpenTasks(t.tasksListIsActiveByTitle.length)} %
|
||||||
button.text-right.toggle voir
|
button.text-right.toggle voir
|
||||||
ul
|
ul
|
||||||
each activetask in t.tasksListIsActiveByTitle
|
each activetask in t.tasksListIsActiveByTitle
|
||||||
|
Loading…
Reference in New Issue
Block a user