added parent is_productive field

This commit is contained in:
2025-02-02 18:47:35 +01:00
parent 3b4ae7a55a
commit 6ff3f05272
10 changed files with 106 additions and 14 deletions

View File

@ -27,4 +27,27 @@ form label {
form button {
align-self: center;
padding: 0.4em 1.2em;
}
form input[type="checkbox"] {
width: 1.6em;
height: 1.6em;
border: solid var(--light1) 2px;
appearance: none;
background: none;
border-radius: 0;
position: relative;
cursor: pointer;
}
form input[type="checkbox"]:checked::after {
content: "";
background-color: #69c935;
width: 80%;
height: 80%;
border-radius: 10%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

View File

@ -13,6 +13,7 @@
marker: none;
gap: 0.8em;
border: solid var(--dark4) 1px;
align-items: center;
}
.list li .actions {

View File

@ -0,0 +1,3 @@
.productive {
box-shadow: 0.2em 0 0 #69c935 inset;
}

View File

@ -127,11 +127,14 @@ class Table {
weekTotalCell.colSpan = length
}
addProject(id, name, sagexNum, times, isParent=false) {
addProject(id, name, sagexNum, times, isParent=false, isProductive=false) {
let row = this.times.insertRow(-1)
row.classList.add("project")
if (isParent) {
row.classList.add("parent")
if (isProductive) {
row.classList.add("productive")
}
}
row.dataset.id = id
row.insertCell(-1).innerText = name
@ -155,11 +158,13 @@ class Table {
if (isParent) {
row.dataset.total = total
this.totalProjects += total
row.insertCell(-1)
row.insertCell(-1)
row.insertCell(-1)
if (isProductive) {
this.totalProjects += total
}
}
row.insertCell(-1)
row.insertCell(-1)
row.insertCell(-1)
}
addMonth(anchorDate) {
@ -230,7 +235,8 @@ class Table {
parent.name,
parent.project_num,
parentDurations.map(v => v === 0 ? "" : v),
true
true,
parent.is_productive
)
projects.forEach(project => {
@ -319,7 +325,7 @@ class Table {
console.log("Total projects = 0")
return
}
this.times.querySelectorAll(".project.parent").forEach(parent => {
this.times.querySelectorAll(".project.parent.productive").forEach(parent => {
let total = +parent.dataset.total
let workingTimeRatio = total / totalClockings
let imputedTimeRatio = total / totalProjects