import json gen

This commit is contained in:
Tykayn 2023-02-06 14:42:26 +01:00 committed by tykayn
parent 6436881cae
commit 8024236fac
2 changed files with 14 additions and 7 deletions

View File

@ -4,8 +4,8 @@
* @type {{duration: string, start: string, content: null}} * @type {{duration: string, start: string, content: null}}
*/ */
import fs from 'node-fs'; import fs from 'node-fs';
import tasksList from '../sources/tasks.json' assert { type: "json" }; //import tasksList from './../sources/tasks.json' assert { type: "json" };
import tasksList from './../sources/tasks.json';
let folderPrefix = './emploi-du-temps/folders_build'; let folderPrefix = './emploi-du-temps/folders_build';
@ -14,7 +14,12 @@ async function foldersGeneration(dirpath){
await fs.promises.mkdir(`${folderPrefix}/${dirpath}`, { recursive: true }) await fs.promises.mkdir(`${folderPrefix}/${dirpath}`, { recursive: true })
} }
export let sectionsCleaned = {} export let sectionsCleaned = {}
// TODO prendre le groupe de type projets; récupérer les tâches de level 2
/**
*
* @param generate_folders
* @returns Object un objet décrivant chaque partie des tasks.json
*/
export function get_sections_from_tasks_orgfile(generate_folders= false){ export function get_sections_from_tasks_orgfile(generate_folders= false){
tasksList.contents.map( elem => { tasksList.contents.map( elem => {

View File

@ -5,7 +5,7 @@
*/ */
import fs from 'node-fs'; import fs from 'node-fs';
import tasksList from '../sources/tasks.json' import tasksList from '../sources/tasks.json'
import {get_sections_from_tasks_orgfile} from "./folder_from_tasks"; assert { type: "json" }; import {get_sections_from_tasks_orgfile} from "./folder_from_tasks.mjs" ;
const timespan_base = { const timespan_base = {
start: "8", start: "8",
@ -52,8 +52,8 @@ const categories = [
'projets', 'projets',
] ]
const projects = ['emploi du temps','rangement','migration Rise','dev','calendar maker','noeud garage','report orgmode','partage ftp'] let projects = ['emploi du temps','rangement','migration Rise','dev','calendar maker','noeud garage','report orgmode','partage ftp']
const areas = [ let areas = [
'achats', 'achats',
'administratif', 'administratif',
'apprendre emacs', 'apprendre emacs',
@ -67,7 +67,7 @@ const areas = [
'travaux bricolage', 'travaux bricolage',
'vacances' 'vacances'
] ]
const ressources = [ let ressources = [
'social sorting', 'social sorting',
'PIM', 'PIM',
'lecture', 'lecture',
@ -172,6 +172,8 @@ let day_categories_map = [
const sections = get_sections_from_tasks_orgfile() const sections = get_sections_from_tasks_orgfile()
projects = Object.keys(sections.projects)
console.log(projects)
function loopOneDay(){ function loopOneDay(){
// passer sur les catégories et faire progresser l'index des éléments des catégories // passer sur les catégories et faire progresser l'index des éléments des catégories