scheduler-node-models 1.0.156 → 1.0.158

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.156",
3
+ "version": "1.0.158",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -247,17 +247,17 @@ class LeaveReport extends general_1.Report {
247
247
  const months = [];
248
248
  for (let i = 0; i < 12; i++) {
249
249
  const dtMonth = new Date(Date.UTC(year, i, 1));
250
- months.push(new leaves_1.LeaveMonth(dtMonth, false));
250
+ months.push(new leaves_1.LeaveMonth(dtMonth, std, false));
251
251
  }
252
252
  months.sort((a, b) => a.compareTo(b));
253
253
  const holidays = [];
254
254
  this.holidays.forEach(hol => {
255
255
  const dt = hol.getActual(year);
256
256
  if (dt) {
257
- holidays.push(new leaves_1.LeaveMonth(dt, false, hol));
257
+ holidays.push(new leaves_1.LeaveMonth(dt, std, false, hol));
258
258
  }
259
259
  else {
260
- holidays.push(new leaves_1.LeaveMonth(new Date(0), false, hol));
260
+ holidays.push(new leaves_1.LeaveMonth(new Date(0), std, false, hol));
261
261
  }
262
262
  });
263
263
  holidays.sort((a, b) => a.compareTo(b));
@@ -16,7 +16,8 @@ export declare class LeaveMonth {
16
16
  holiday?: Holiday;
17
17
  disabled: boolean;
18
18
  periods: LeavePeriod[];
19
- constructor(start: Date, disabled: boolean, holiday?: Holiday);
19
+ standard: number;
20
+ constructor(start: Date, std: number, disabled: boolean, holiday?: Holiday);
20
21
  compareTo(other?: LeaveMonth): number;
21
22
  getHours(type?: string, actuals?: boolean): number;
22
23
  addLeave(leave: Leave): void;
@@ -57,8 +57,10 @@ class LeaveMonth {
57
57
  holiday;
58
58
  disabled;
59
59
  periods;
60
- constructor(start, disabled, holiday) {
60
+ standard;
61
+ constructor(start, std, disabled, holiday) {
61
62
  this.month = new Date(start);
63
+ this.standard = std;
62
64
  this.disabled = disabled;
63
65
  this.periods = [];
64
66
  this.holiday = undefined;
@@ -89,15 +91,17 @@ class LeaveMonth {
89
91
  }
90
92
  addLeave(leave) {
91
93
  let bAdded = false;
92
- this.periods.forEach((prd, p) => {
93
- if (!bAdded && leave.code.toLowerCase() === prd.code.toLowerCase()
94
- && leave.status.toLowerCase() === prd.status.toLowerCase()
95
- && leave.leavedate.getDate() === prd.end.getDate() + 1) {
96
- bAdded = true;
97
- prd.addLeave(leave);
98
- this.periods[p] = prd;
99
- }
100
- });
94
+ if (leave.hours === this.standard) {
95
+ this.periods.forEach((prd, p) => {
96
+ if (!bAdded && leave.code.toLowerCase() === prd.code.toLowerCase()
97
+ && leave.status.toLowerCase() === prd.status.toLowerCase()
98
+ && leave.leavedate.getDate() === prd.end.getDate() + 1) {
99
+ bAdded = true;
100
+ prd.addLeave(leave);
101
+ this.periods[p] = prd;
102
+ }
103
+ });
104
+ }
101
105
  if (!bAdded) {
102
106
  this.periods.push(new LeavePeriod(leave));
103
107
  }