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-09-22 15:47:12 +02:00
|
|
|
// import tasksList from '/home/tykayn/Nextcloud/ressources/social sorting/output/emacs_export_tasks.json' assert { type: "json" };
|
|
|
|
import { get_sections_from_tasks_orgfile } from './folder_from_tasks.mjs'
|
2023-01-08 16:10:29 +01:00
|
|
|
|
|
|
|
const timespan_base = {
|
2023-09-22 15:47:12 +02:00
|
|
|
start: '8',
|
|
|
|
duration: '60', // minutes
|
|
|
|
content: null
|
2023-01-08 16:10:29 +01:00
|
|
|
}
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
const day_start_hour = 9
|
|
|
|
const day_activities_hours = 10
|
|
|
|
const activity_duration_default = 60
|
2023-01-09 00:04:26 +01:00
|
|
|
|
|
|
|
const ressources_nope = [
|
2023-09-22 15:47:12 +02:00
|
|
|
{
|
|
|
|
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'
|
|
|
|
},
|
2023-01-09 00:04:26 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
const categories = [
|
2023-09-22 15:47:12 +02:00
|
|
|
'aires de responsabilité',
|
|
|
|
'archives',
|
|
|
|
'ressources',
|
|
|
|
'projets',
|
2023-01-09 00:04:26 +01:00
|
|
|
]
|
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
let projects = ['emploi du temps', 'rangement', 'migration Rise', 'dev', 'calendar maker', 'noeud garage', 'report orgmode', 'partage ftp']
|
2023-02-06 14:42:26 +01:00
|
|
|
let areas = [
|
2023-09-22 15:47:12 +02:00
|
|
|
'achats',
|
|
|
|
'administratif',
|
|
|
|
'apprendre emacs',
|
|
|
|
'associations',
|
|
|
|
'boulot',
|
|
|
|
'communication et écriture',
|
|
|
|
'corvées',
|
|
|
|
'habitudes',
|
|
|
|
'santé',
|
|
|
|
'social',
|
|
|
|
'travaux bricolage',
|
|
|
|
'vacances'
|
2023-01-09 00:04:26 +01:00
|
|
|
]
|
2023-02-06 14:42:26 +01:00
|
|
|
let ressources = [
|
2023-09-22 15:47:12 +02: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 = [
|
2023-09-22 15:47:12 +02:00
|
|
|
{
|
|
|
|
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'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
start: '21',
|
|
|
|
duration: '30', // minutes
|
|
|
|
label: 'préparation dodo',
|
|
|
|
color: 'white'
|
|
|
|
},
|
2023-01-08 16:10:29 +01:00
|
|
|
|
|
|
|
]
|
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
const days = [{
|
2023-09-22 15:47:12 +02:00
|
|
|
label: 'lundi'
|
2023-01-09 00:04:26 +01:00
|
|
|
}, {
|
2023-09-22 15:47:12 +02:00
|
|
|
label: 'mardi'
|
2023-01-09 00:04:26 +01:00
|
|
|
}, {
|
2023-09-22 15:47:12 +02:00
|
|
|
label: 'mercredi'
|
2023-01-09 00:04:26 +01:00
|
|
|
}, {
|
2023-09-22 15:47:12 +02:00
|
|
|
label: 'jeudi'
|
2023-01-09 00:04:26 +01:00
|
|
|
}, {
|
2023-09-22 15:47:12 +02:00
|
|
|
label: 'vendredi'
|
2023-01-09 00:04:26 +01:00
|
|
|
},
|
2023-09-22 15:47:12 +02:00
|
|
|
/**
|
2023-01-09 00:04:26 +01:00
|
|
|
{
|
|
|
|
label: "samedi"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "dimanche"
|
|
|
|
},
|
2023-09-22 15:47:12 +02:00
|
|
|
**/
|
2023-01-08 16:10:29 +01:00
|
|
|
]
|
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
function displayDays () {
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
console.log('projets', projects.length)
|
|
|
|
console.log('aires de responsabilité', areas.length)
|
|
|
|
console.log('ressources actuelles', ressources.length)
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
days.forEach((elem, index) => {
|
2023-01-08 16:10:29 +01:00
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
// ajouter les créneaux à chaque journée
|
2023-09-22 15:47:12 +02:00
|
|
|
console.log('')
|
|
|
|
console.log('*', elem.label)
|
|
|
|
loopOneDay()
|
2023-01-08 16:10:29 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
})
|
|
|
|
}
|
2023-01-09 00:04:26 +01:00
|
|
|
|
|
|
|
// configs qui bouclent pour chaque catégorie
|
2023-09-22 15:47:12 +02:00
|
|
|
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
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
let day_categories_map = []
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
const sections = get_sections_from_tasks_orgfile()
|
|
|
|
console.log('sections', sections)
|
|
|
|
if (sections.projects) {
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
projects = Object.keys(sections.projects)
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
console.log(projects)
|
|
|
|
}
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
function loopOneDay () {
|
|
|
|
// passer sur les catégories et faire progresser l'index des éléments des catégories
|
2023-02-06 13:09:01 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
console.log('** ', day_hour, 'h revue journalière')
|
|
|
|
day_minutes_counter += daily_duration
|
2023-02-06 13:09:01 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
console.log('** ', convertMinutesOfDayToHourDisplay(day_minutes_counter), 'h appels tel')
|
|
|
|
day_minutes_counter += 20
|
2023-02-06 13:09:01 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
resetIndexesIfNeeded()
|
|
|
|
|
|
|
|
console.log('** areas : ', area_index, ' : ', convertMinutesOfDayToHourDisplay(day_minutes_counter), areas[area_index])
|
|
|
|
day_minutes_counter += activity_duration_default
|
|
|
|
area_index++
|
|
|
|
resetIndexesIfNeeded()
|
2023-01-09 00:04:26 +01:00
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
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()
|
|
|
|
|
|
|
|
console.log('** ', convertMinutesOfDayToHourDisplay(day_minutes_counter), 'h temps libre')
|
|
|
|
day_minutes_counter += 120
|
|
|
|
|
|
|
|
day_minutes_counter = 0
|
2023-01-09 00:04:26 +01:00
|
|
|
// for(let ii =day_minutes_counter; ii < max_min_a_day; ii+=activity_duration_default ){
|
2023-09-22 15:47:12 +02:00
|
|
|
|
2023-01-09 00:04:26 +01:00
|
|
|
// day_minutes_counter += activity_duration_default
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
function resetIndexesIfNeeded () {
|
|
|
|
if (area_index >= areas.length) {
|
|
|
|
area_index = 0
|
2023-01-09 00:04:26 +01:00
|
|
|
console.log('# --- retour de areas --- ')
|
|
|
|
}
|
2023-09-22 15:47:12 +02:00
|
|
|
if (ressources_index >= ressources.length) {
|
|
|
|
ressources_index = 0
|
2023-01-09 00:04:26 +01:00
|
|
|
console.log('# --- retour de ressources --- ')
|
|
|
|
}
|
2023-09-22 15:47:12 +02:00
|
|
|
if (projects_index >= projects.length) {
|
|
|
|
projects_index = 0
|
|
|
|
console.log('# --- retour de projets --- ')
|
2023-01-09 00:04:26 +01:00
|
|
|
}
|
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
}
|
2023-01-09 00:04:26 +01:00
|
|
|
|
|
|
|
// TODO améliorer le rendu pour avoir les minutes arrondies dans l'heure
|
2023-09-22 15:47:12 +02:00
|
|
|
function convertMinutesOfDayToHourDisplay (max_min_a_day) {
|
2023-01-09 00:04:26 +01:00
|
|
|
|
|
|
|
// return day_start_hour + (max_min_a_day/60) + ' h'
|
2023-09-22 15:47:12 +02:00
|
|
|
return day_start_hour + Math.round(max_min_a_day / 60) + 'h'
|
2023-01-09 00:04:26 +01:00
|
|
|
}
|
|
|
|
|
2023-09-22 15:47:12 +02:00
|
|
|
console.log('* Emploi du temps pour deux semaines sans inclure les weekend \n')
|
|
|
|
displayDays()
|