scheduler-node-models 1.0.155 → 1.0.157

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.155",
3
+ "version": "1.0.157",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -56,7 +56,6 @@ class LeaveReport extends general_1.Report {
56
56
  this.employees.push(emp);
57
57
  }
58
58
  });
59
- console.log(this.employees.length);
60
59
  this.employees.sort((a, b) => a.compareTo(b));
61
60
  const workbook = new exceljs_1.Workbook();
62
61
  workbook.creator = user.getFullName();
@@ -248,17 +247,17 @@ class LeaveReport extends general_1.Report {
248
247
  const months = [];
249
248
  for (let i = 0; i < 12; i++) {
250
249
  const dtMonth = new Date(Date.UTC(year, i, 1));
251
- months.push(new leaves_1.LeaveMonth(dtMonth, false));
250
+ months.push(new leaves_1.LeaveMonth(dtMonth, std, false));
252
251
  }
253
252
  months.sort((a, b) => a.compareTo(b));
254
253
  const holidays = [];
255
254
  this.holidays.forEach(hol => {
256
255
  const dt = hol.getActual(year);
257
256
  if (dt) {
258
- holidays.push(new leaves_1.LeaveMonth(dt, false, hol));
257
+ holidays.push(new leaves_1.LeaveMonth(dt, std, false, hol));
259
258
  }
260
259
  else {
261
- holidays.push(new leaves_1.LeaveMonth(new Date(0), false, hol));
260
+ holidays.push(new leaves_1.LeaveMonth(new Date(0), std, false, hol));
262
261
  }
263
262
  });
264
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
  }