made empty project lines hidden

This commit is contained in:
Louis Heredero 2025-03-01 13:40:24 +01:00
parent 9e2566ba03
commit 7f845dcb1d
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7

View File

@ -216,17 +216,20 @@ class Table {
let projects = parent.projects.map(project => { let projects = parent.projects.map(project => {
let durations = Array(this.nDays).fill("") let durations = Array(this.nDays).fill("")
let total = 0
project.tasks.forEach(task => { project.tasks.forEach(task => {
let date = new Date(task.date) let date = new Date(task.date)
let i = Math.floor((date.valueOf() - this.startDate.valueOf()) / DAY_MS) let i = Math.floor((date.valueOf() - this.startDate.valueOf()) / DAY_MS)
let hours = task.duration / 60 let hours = task.duration / 60
durations[i] = hours durations[i] = hours
total += hours
parentDurations[i] += hours parentDurations[i] += hours
}) })
return { return {
id: project.id, id: project.id,
name: project.name, name: project.name,
durations: durations durations: durations,
total: total
} }
}) })
@ -239,7 +242,7 @@ class Table {
parent.is_productive parent.is_productive
) )
projects.forEach(project => { projects.filter(p => p.total !== 0).forEach(project => {
this.addProject(project.id, project.name, "", project.durations) this.addProject(project.id, project.name, "", project.durations)
}) })
}) })