Skip to content

Commit

Permalink
Fix thamara#250: Don't allow waiver to be added to non-working day
Browse files Browse the repository at this point in the history
  • Loading branch information
tupaschoal committed May 31, 2020
1 parent d4d29d6 commit 8915002
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
- Fix: [#233] Fixes crash when opening the waiver for a day
- Fix: [#229] Count Today in totals no longer causes problem in the month balance
- Fix: [#239] Punch button is disabled when current day is waived
- Fix: [#249] Fix loading preferences
- Fix: [#250] Don't allow addition of waivers to non-working days
- Enhancement: [#228] Improved performance of TTL - Now moving through the calendar is much faster
- Enhancement: [#152] Adding a "Copy" option in the "About message", making it easier to copy information when opening an issue
- Upgrade: Upgrading jquery to 3.5.0
- Upgrade: [#236] Upgrade all dependencies

8 changes: 7 additions & 1 deletion src/workday-waiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ function addWaiver() {
alert(`You already have a waiver on ${temp_date_str}. Remove it before adding a new one.`);
return;
}

var [temp_year, temp_month, temp_day] = getDateFromISOStr(temp_date_str);
if (!showDay(temp_year, temp_month-1, temp_day) && !store.has(temp_date_str)) {
alert(`You cannot add a waiver on ${temp_date_str}. It is a non-working day.`);
return;
}

temp_date.setDate(temp_date.getDate() + 1);
}
Expand All @@ -96,7 +102,7 @@ function addWaiver() {

for (i = 0; i <= diff; i++) {
temp_date_str = getDateStr(temp_date);
var [temp_year, temp_month, temp_day] = getDateFromISOStr(temp_date_str);
[temp_year, temp_month, temp_day] = getDateFromISOStr(temp_date_str);
if (showDay(temp_year, temp_month-1, temp_day) && !store.has(temp_date_str)) {
store.set(temp_date_str, { 'reason' : reason, 'hours' : hours });
addRowToListTable(temp_date_str, reason, hours);
Expand Down

0 comments on commit 8915002

Please sign in to comment.