error on invalid hours argument

master
Yorick van Pelt 2019-06-27 13:21:47 +02:00
rodzic d7ae16d715
commit 46695b8236
Podpisane przez: yorick
ID klucza GPG: A36E70F9DC014A15
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -206,6 +206,9 @@ class App {
async update(sheetname, startDate, endDate, hours) { // set values in sheet
console.log("Setting data in", sheetname)
hours = +hours
if (isNaN(hours)) {
throw "hours argument not a float or int"
}
const values = {
regular: Math.min(hours, 80),
overwork: Math.max(0, hours-80),