2023-01-08 16:10:29 +01:00
|
|
|
/**
|
|
|
|
* création d'emploi du temps avec des zones découpées en catégorie
|
|
|
|
* cela permet de parcourir tous les aspects de la méthodologie PARA sur différents créneaux
|
|
|
|
* @type {{duration: string, start: string, content: null}}
|
|
|
|
*/
|
2023-02-06 13:09:01 +01:00
|
|
|
import fs from 'node-fs';
|
|
|
|
import tasksList from '../sources/tasks.json'
|
2023-02-06 14:42:26 +01:00
|
|
|
import {get_sections_from_tasks_orgfile} from "./folder_from_tasks.mjs" ;
|
2023-01-08 16:10:29 +01:00
|
|
|
|
|
|
|
const timespan_base = {
|
|
|
|
start: "8",
|
|
|
|
duration: "60", // minutes
|
|
|
|
content: null
|
|
|
|
}
|
2023-01-09 00:04:26 +01:00
|
|
|
|
|
|
|
const day_start_hour = 9;
|
|
|
|
const day_activities_hours = 10;
|
|
|
|
const activity_duration_default=60;
|
|
|
|
|
|
|
|
const ressources_nope = [
|
|
|
|
{
|
|
|
|
label: "social sorting"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "gestion de l'information"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "lecture"
|
|
|
|
}, {
|
|
|
|
|
|
|
|
label: "architecture"
|
|
|
|
}, {
|
|
|
|
label: "climat"
|
|
|
|
}, {
|
|
|
|
label: "nucléaire"
|
|
|
|
}, {
|
|
|
|
label: "dessins"
|
|
|
|
}, {
|
|
|
|
label: "partage de documents"
|
|
|
|
}, {
|
|
|
|
label: "recherche et éducation"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "emploi du temps"
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
const categories = [
|
|
|
|
'aires de responsabilité',
|
|
|
|
'archives',
|
|
|
|
'ressources',
|
|
|
|
'projets',
|
|
|
|
]
|
|
|
|
|
2023-02-06 14:42:26 +01:00
|
|
|
let projects = ['emploi du temps','rangement','migration Rise','dev','calendar maker','noeud garage','report orgmode','partage ftp']
|
|
|
|
let areas = [
|
2023-01-09 00:04:26 +01:00
|
|
|
'achats',
|
|
|
|
'administratif',
|
|
|
|
'apprendre emacs',
|
|
|
|
'associations',
|
|
|
|
'boulot',
|
|
|
|
'communication et écriture',
|
|
|
|
'corvées',
|
|
|
|
'habitudes',
|
|
|
|
'santé',
|
|
|
|
'social',
|
|
|
|
'travaux bricolage',
|
|
|
|
'vacances'
|
|
|
|
]
|
2023-02-06 14:42:26 +01:00
|
|
|
let ressources = [
|
2023-01-09 00:04:26 +01:00
|
|
|
'social sorting',
|
|
|
|
'PIM',
|
|
|
|
'lecture',
|
|
|
|
'architecture',
|
|
|
|
'climat',
|
|
|
|
'nucléaire',
|
|
|
|
'dessins',
|
|
|
|
'partage de documents',
|
|
|
|
'recherche et éducation'
|
2023-01-08 16:10:29 +01:00
|
|
|
]
|
|
|
|
// préremplir avec des créneaux réservés
|
|
|
|
|
|
|
|
const hours_spans = [
|
|
|
|
{
|
|
|
|
start: "8",
|
|
|
|
duration: "60", // minutes
|
|
|
|
label: "matin",
|
|
|
|
color: "white"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
start: "12",
|
|
|
|
duration: "60", // minutes
|
|
|
|
label: "midi bouffe",
|
|
|
|
color: "white"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
start: "16",
|
|
|
|
duration: "30", // minutes
|
|
|
|
label: "goûter",
|
|
|
|
color: "white"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
start: "19",
|
|
|
|
duration: "30", // minutes
|
|
|
|
label: "bouffe soir",
|
|
|
|
color: "white"
|
|
|
|
},
|
|
|
|
{
|
2023-01-09 00:04:26 +01:00
|
|
|
start: "21",
|
2023-01-08 16:10:29 +01:00
|
|
|
duration: "30", // minutes
|
|
|
|
label: "préparation dodo",
|
|
|
|
color: "white"
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
const days = [{
|
|
|
|
label: "lundi"
|
|
|
|
}, {
|
|
|
|
label: "mardi"
|
|
|
|
}, {
|
|
|
|
label: "mercredi"
|
|
|
|
}, {
|
|
|
|
label: "jeudi"
|
|
|
|
}, {
|
|
|
|
label: "vendredi"
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
{
|
|
|
|
label: "samedi"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "dimanche"
|
|
|
|
},
|
|
|
|
**/
|
2023-01-08 16:10:29 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
function displayDays() {
|
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
console.log('projets', projects.length)
|
|
|
|
console.log('aires de responsabilité', areas.length)
|
|
|
|
console.log('ressources actuelles', ressources.length)
|
|
|
|
|
|
|
|
|
2023-01-08 16:10:29 +01:00
|
|
|
days.forEach((elem, index) => {
|
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
// ajouter les créneaux à chaque journée
|
|
|
|
console.log('' )
|
|
|
|
console.log('*' , elem.label )
|
|
|
|
loopOneDay();
|
|
|
|
|
2023-01-08 16:10:29 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
|
|
|
|
// configs qui bouclent pour chaque catégorie
|
|
|
|
let category_index = 0;
|
|
|
|
let projects_index = 0;
|
|
|
|
let area_index = 0;
|
|
|
|
let ressources_index = 0;
|
|
|
|
let day_hour = day_start_hour;
|
|
|
|
let day_minutes_counter = 0;
|
|
|
|
let max_min_a_day = day_minutes_counter * day_activities_hours;
|
|
|
|
let daily_duration = 15; // minutes
|
|
|
|
|
|
|
|
let day_categories_map = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2023-02-06 13:09:01 +01:00
|
|
|
|
|
|
|
const sections = get_sections_from_tasks_orgfile()
|
|
|
|
|
2023-02-06 14:42:26 +01:00
|
|
|
projects = Object.keys(sections.projects)
|
|
|
|
console.log(projects)
|
2023-02-06 13:09:01 +01:00
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
function loopOneDay(){
|
|
|
|
// passer sur les catégories et faire progresser l'index des éléments des catégories
|
|
|
|
|
|
|
|
console.log('** ' ,day_hour ,'h revue journalière')
|
|
|
|
day_minutes_counter += daily_duration
|
|
|
|
|
|
|
|
console.log('** ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,'h appels tel')
|
|
|
|
day_minutes_counter += 20
|
|
|
|
|
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
|
|
|
console.log('** areas : ' ,area_index, ' : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,areas[area_index])
|
|
|
|
day_minutes_counter += activity_duration_default
|
|
|
|
area_index++
|
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
|
|
|
console.log('** areas : ' ,area_index, ' : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,areas[area_index])
|
|
|
|
day_minutes_counter += activity_duration_default
|
|
|
|
area_index++
|
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
|
|
|
console.log('** projects : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,projects[projects_index])
|
|
|
|
day_minutes_counter += activity_duration_default
|
|
|
|
projects_index++
|
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
|
|
|
console.log('** projects : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,projects[projects_index])
|
|
|
|
day_minutes_counter += activity_duration_default
|
|
|
|
projects_index++
|
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
|
|
|
console.log('** projects : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,projects[projects_index])
|
|
|
|
day_minutes_counter += activity_duration_default
|
|
|
|
projects_index++
|
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
|
|
|
console.log('** ressources : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,ressources[ressources_index])
|
|
|
|
day_minutes_counter += activity_duration_default
|
|
|
|
ressources_index++
|
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
2023-01-09 00:08:52 +01:00
|
|
|
console.log('** ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,'h temps libre')
|
|
|
|
day_minutes_counter += 120
|
2023-01-09 00:04:26 +01:00
|
|
|
|
|
|
|
day_minutes_counter = 0;
|
|
|
|
// for(let ii =day_minutes_counter; ii < max_min_a_day; ii+=activity_duration_default ){
|
|
|
|
|
|
|
|
// day_minutes_counter += activity_duration_default
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetIndexesIfNeeded(){
|
|
|
|
if(area_index >= areas.length){
|
|
|
|
area_index = 0;
|
|
|
|
console.log('# --- retour de areas --- ')
|
|
|
|
}
|
|
|
|
if(ressources_index >= ressources.length){
|
|
|
|
ressources_index = 0;
|
|
|
|
console.log('# --- retour de ressources --- ')
|
|
|
|
}
|
|
|
|
if(projects_index >= projects.length){
|
|
|
|
projects_index = 0;
|
|
|
|
console.log('# --- retour de projets --- ')
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO améliorer le rendu pour avoir les minutes arrondies dans l'heure
|
|
|
|
function convertMinutesOfDayToHourDisplay(max_min_a_day){
|
|
|
|
|
|
|
|
// return day_start_hour + (max_min_a_day/60) + ' h'
|
|
|
|
return day_start_hour + Math.round(max_min_a_day/60) + 'h'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-09 00:08:52 +01:00
|
|
|
console.log("* Emploi du temps pour deux semaines sans inclure les weekend \n")
|
2023-02-06 13:09:01 +01:00
|
|
|
//displayDays();
|