Add productive_time = work_time if productive_time is not defined, add ability…

Add productive_time = work_time if productive_time is not defined, add ability for adding time equals zero
parent 9460d77f
......@@ -166,10 +166,12 @@ window.addEventListener("load", function() {
workTime === parseInt(btn.dataset["time"])
? parseInt(btn.dataset["time"])
: workTime;
workTime = workTime > 0 ? workTime : 1;
workTime = workTime > 0 ? workTime : 0;
let workTimeValue = Math.ceil((workTime / 60) * 100) / 100;
let productiveTime = parseInt(document.querySelector("#ProductTime").value);
productiveTime = productiveTime > 0 ? productiveTime : 1;
productiveTime = productiveTime > 0 ? productiveTime : workTime;
let productiveTimeValue = Math.ceil((productiveTime / 60) * 100) / 100;
document.querySelector("#work_time").value = workTimeValue;
document.querySelector("#productive_time").value = productiveTimeValue;
......@@ -261,4 +263,4 @@ if (typeof window.addEventListener != "undefined") {
} else if (typeof window.attachEvent != "undefined") {
//win/ie
window.attachEvent("onload", initTimer);
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment