scheduler-node-models 1.0.144 → 1.0.146

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scheduler-node-models",
3
- "version": "1.0.144",
3
+ "version": "1.0.146",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -354,8 +354,8 @@ class LeaveReport extends general_1.Report {
354
354
  const num = Number(empHol.tagday.substring(1));
355
355
  holidays.forEach((hol, h) => {
356
356
  if (hol.holiday && hol.holiday.id.toLowerCase() === code
357
- && hol.holiday.sort === num) {
358
- hol.periods.push(new leaves_1.LeavePeriod(new employees_1.Leave(empHol)));
357
+ && hol.holiday.sort === num && !empHol.used) {
358
+ hol.addLeave(empHol);
359
359
  empHol.used = true;
360
360
  holidays[h] = hol;
361
361
  empHolidays[eh] = empHol;
@@ -367,9 +367,9 @@ class LeaveReport extends general_1.Report {
367
367
  empHolidays.forEach((empHol, eh) => {
368
368
  if (!empHol.used && empHol.status.toLowerCase() === 'actual') {
369
369
  holidays.forEach((hol, h) => {
370
- if (hol.holiday && hol.holiday.id.toLowerCase() === 'h'
370
+ if (!empHol.used && hol.holiday && hol.holiday.id.toLowerCase() === 'h'
371
371
  && !hol.disabled && hol.getHours() + empHol.hours <= 8.0) {
372
- hol.periods.push(new leaves_1.LeavePeriod(new employees_1.Leave(empHol)));
372
+ hol.addLeave(empHol);
373
373
  empHol.used = true;
374
374
  holidays[h] = hol;
375
375
  empHolidays[eh] = empHol;
@@ -381,10 +381,10 @@ class LeaveReport extends general_1.Report {
381
381
  empHolidays.forEach((empHol, eh) => {
382
382
  if (!empHol.used) {
383
383
  holidays.forEach((hol, h) => {
384
- if (hol.holiday && hol.holiday.id.toLowerCase() === 'h'
384
+ if (!empHol.used && hol.holiday && hol.holiday.id.toLowerCase() === 'h'
385
385
  && hol.month.getTime() === empHol.leavedate.getTime()
386
386
  && !hol.disabled && hol.getHours() + empHol.hours <= 8.0) {
387
- hol.periods.push(new leaves_1.LeavePeriod(new employees_1.Leave(empHol)));
387
+ hol.addLeave(empHol);
388
388
  empHol.used = true;
389
389
  holidays[h] = hol;
390
390
  empHolidays[eh] = empHol;
@@ -399,10 +399,11 @@ class LeaveReport extends general_1.Report {
399
399
  holidays.forEach((hol, h) => {
400
400
  if (!found && !hol.disabled) {
401
401
  if (hol.getHours() + empHol.hours <= 8.0) {
402
- hol.periods.push(new leaves_1.LeavePeriod(new employees_1.Leave(empHol)));
402
+ hol.addLeave(empHol);
403
403
  holidays[h] = hol;
404
404
  found = true;
405
405
  empHol.used = true;
406
+ empHolidays[eh] = empHol;
406
407
  }
407
408
  }
408
409
  });
@@ -415,7 +416,7 @@ class LeaveReport extends general_1.Report {
415
416
  holidays.forEach((hol, h) => {
416
417
  if (!found && hol.disabled) {
417
418
  found = true;
418
- hol.periods.push(new leaves_1.LeavePeriod(new employees_1.Leave(empHol)));
419
+ hol.addLeave(empHol);
419
420
  }
420
421
  });
421
422
  }
@@ -423,9 +424,8 @@ class LeaveReport extends general_1.Report {
423
424
  // next, place the non-holiday leaves into the months they are using in.
424
425
  empOtherLeaves.sort((a, b) => a.compareTo(b));
425
426
  empOtherLeaves.forEach(lv => {
426
- let lvFound = false;
427
427
  months.forEach((month, m) => {
428
- if (!lvFound && month.month.getUTCFullYear() === lv.leavedate.getUTCFullYear()
428
+ if (month.month.getUTCFullYear() === lv.leavedate.getUTCFullYear()
429
429
  && month.month.getUTCMonth() === lv.leavedate.getUTCMonth()) {
430
430
  month.addLeave(lv);
431
431
  months[m] = month;
@@ -460,8 +460,7 @@ class LeaveReport extends general_1.Report {
460
460
  if (hol.holiday.getActual(year)) {
461
461
  const formatter = new Intl.DateTimeFormat('en-US', {
462
462
  month: 'short',
463
- day: '2-digit',
464
- year: '2-digit'
463
+ day: '2-digit'
465
464
  });
466
465
  this.setCell(sheet, this.getCellID(col + 1, holRow), this.getCellID(col + 1, holRow), style, formatter.format(hol.holiday.getActual(year)));
467
466
  }
@@ -537,7 +536,7 @@ class LeaveReport extends general_1.Report {
537
536
  }
538
537
  let text = '';
539
538
  let bHours = false;
540
- if (prd.start.getTime() === prd.end.getTime()) {
539
+ if (prd.start.getTime() !== prd.end.getTime()) {
541
540
  text = `${prd.start.getDate()}-${prd.end.getDate()}`;
542
541
  }
543
542
  else {
@@ -94,8 +94,7 @@ class LeaveMonth {
94
94
  && leave.status.toLowerCase() === prd.status.toLowerCase()
95
95
  && leave.leavedate.getDate() === prd.end.getDate() + 1) {
96
96
  bAdded = true;
97
- prd.leaves.push(new employees_1.Leave(leave));
98
- prd.end = new Date(leave.leavedate);
97
+ prd.addLeave(leave);
99
98
  this.periods[p] = prd;
100
99
  }
101
100
  });