254 lines
6.2 KiB
JavaScript
254 lines
6.2 KiB
JavaScript
/**
|
|
* 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}}
|
|
*/
|
|
|
|
const timespan_base = {
|
|
start: "8",
|
|
duration: "60", // minutes
|
|
content: null
|
|
}
|
|
|
|
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',
|
|
]
|
|
|
|
const projects = ['emploi du temps','rangement','migration Rise','dev','calendar maker','noeud garage','report orgmode','partage ftp']
|
|
const areas = [
|
|
'achats',
|
|
'administratif',
|
|
'apprendre emacs',
|
|
'associations',
|
|
'boulot',
|
|
'communication et écriture',
|
|
'corvées',
|
|
'habitudes',
|
|
'santé',
|
|
'social',
|
|
'travaux bricolage',
|
|
'vacances'
|
|
]
|
|
const ressources = [
|
|
'social sorting',
|
|
'PIM',
|
|
'lecture',
|
|
'architecture',
|
|
'climat',
|
|
'nucléaire',
|
|
'dessins',
|
|
'partage de documents',
|
|
'recherche et éducation'
|
|
]
|
|
// 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"
|
|
},
|
|
{
|
|
start: "21",
|
|
duration: "30", // minutes
|
|
label: "préparation dodo",
|
|
color: "white"
|
|
},
|
|
|
|
]
|
|
|
|
const days = [{
|
|
label: "lundi"
|
|
}, {
|
|
label: "mardi"
|
|
}, {
|
|
label: "mercredi"
|
|
}, {
|
|
label: "jeudi"
|
|
}, {
|
|
label: "vendredi"
|
|
},
|
|
/**
|
|
{
|
|
label: "samedi"
|
|
},
|
|
{
|
|
label: "dimanche"
|
|
},
|
|
**/
|
|
]
|
|
|
|
function displayDays() {
|
|
|
|
console.log('projets', projects.length)
|
|
console.log('aires de responsabilité', areas.length)
|
|
console.log('ressources actuelles', ressources.length)
|
|
|
|
|
|
days.forEach((elem, index) => {
|
|
|
|
// ajouter les créneaux à chaque journée
|
|
console.log('' )
|
|
console.log('*' , elem.label )
|
|
loopOneDay();
|
|
|
|
})
|
|
}
|
|
|
|
|
|
// 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 = [
|
|
|
|
|
|
|
|
]
|
|
|
|
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()
|
|
|
|
console.log('** ressources : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,ressources[ressources_index])
|
|
day_minutes_counter += activity_duration_default
|
|
ressources_index++
|
|
resetIndexesIfNeeded()
|
|
|
|
console.log('** ressources : ' ,convertMinutesOfDayToHourDisplay(day_minutes_counter) ,ressources[ressources_index])
|
|
day_minutes_counter += activity_duration_default
|
|
ressources_index++
|
|
resetIndexesIfNeeded()
|
|
|
|
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'
|
|
}
|
|
|
|
|
|
console.log("* Emploi du temps pour une semaine \n")
|
|
displayDays();
|