scheduler-node-models 1.0.154 → 1.0.156

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.154",
3
+ "version": "1.0.156",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -28,7 +28,7 @@ export interface IEmployee {
28
28
  companyinfo: ICompanyInfo;
29
29
  assignments?: IAssignment[];
30
30
  variations?: IVariation[];
31
- balance?: IAnnualLeave[];
31
+ balances?: IAnnualLeave[];
32
32
  leaves?: ILeave[];
33
33
  requests?: ILeaveRequest[];
34
34
  laborCodes?: IEmployeeLaborCode[];
@@ -47,7 +47,7 @@ export declare class Employee implements IEmployee {
47
47
  companyinfo: ICompanyInfo;
48
48
  assignments: Assignment[];
49
49
  variations: Variation[];
50
- balance: AnnualLeave[];
50
+ balances: AnnualLeave[];
51
51
  leaves: Leave[];
52
52
  requests: LeaveRequest[];
53
53
  laborCodes: EmployeeLaborCode[];
@@ -23,7 +23,7 @@ class Employee {
23
23
  companyinfo;
24
24
  assignments;
25
25
  variations;
26
- balance;
26
+ balances;
27
27
  leaves;
28
28
  requests;
29
29
  laborCodes;
@@ -56,12 +56,12 @@ class Employee {
56
56
  });
57
57
  this.variations.sort((a, b) => a.compareTo(b));
58
58
  }
59
- this.balance = [];
60
- if (emp && emp.balance && emp.balance.length > 0) {
61
- emp.balance.forEach(b => {
62
- this.balance.push(new balance_1.AnnualLeave(b));
59
+ this.balances = [];
60
+ if (emp && emp.balances && emp.balances.length > 0) {
61
+ emp.balances.forEach(b => {
62
+ this.balances.push(new balance_1.AnnualLeave(b));
63
63
  });
64
- this.balance.sort((a, b) => a.compareTo(b));
64
+ this.balances.sort((a, b) => a.compareTo(b));
65
65
  }
66
66
  this.leaves = [];
67
67
  if (emp && emp.leaves && emp.leaves.length > 0) {
@@ -182,10 +182,10 @@ class Employee {
182
182
  }
183
183
  }
184
184
  // purge old leave balances
185
- this.balance.sort((a, b) => a.compareTo(b));
186
- for (let b = this.balance.length - 1; b >= 0; b--) {
187
- if (this.balance[b].year < date.getUTCFullYear()) {
188
- this.balance.splice(b, 1);
185
+ this.balances.sort((a, b) => a.compareTo(b));
186
+ for (let b = this.balances.length - 1; b >= 0; b--) {
187
+ if (this.balances[b].year < date.getUTCFullYear()) {
188
+ this.balances.splice(b, 1);
189
189
  }
190
190
  }
191
191
  // return as to whether the employee quit before date
@@ -880,7 +880,7 @@ class Employee {
880
880
  let found = false;
881
881
  let lastAnnual = 0.0;
882
882
  let lastCarry = 0.0;
883
- this.balance.forEach(bal => {
883
+ this.balances.forEach(bal => {
884
884
  if (bal.year === year) {
885
885
  found = true;
886
886
  }
@@ -908,8 +908,8 @@ class Employee {
908
908
  });
909
909
  bal.carryover = carry;
910
910
  }
911
- this.balance.push(bal);
912
- this.balance.sort((a, b) => a.compareTo(b));
911
+ this.balances.push(bal);
912
+ this.balances.sort((a, b) => a.compareTo(b));
913
913
  }
914
914
  }
915
915
  /**
@@ -922,10 +922,10 @@ class Employee {
922
922
  */
923
923
  updateLeaveBalance(year, annual, carry) {
924
924
  let found = false;
925
- for (let lb = 0; lb < this.balance.length && !found; lb++) {
926
- if (this.balance[lb].year === year) {
927
- this.balance[lb].annual = annual;
928
- this.balance[lb].carryover = carry;
925
+ for (let lb = 0; lb < this.balances.length && !found; lb++) {
926
+ if (this.balances[lb].year === year) {
927
+ this.balances[lb].annual = annual;
928
+ this.balances[lb].carryover = carry;
929
929
  }
930
930
  }
931
931
  if (!found) {
@@ -934,9 +934,9 @@ class Employee {
934
934
  annual: annual,
935
935
  carryover: carry
936
936
  });
937
- this.balance.push(lb);
937
+ this.balances.push(lb);
938
938
  }
939
- this.balance.sort((a, b) => a.compareTo(b));
939
+ this.balances.sort((a, b) => a.compareTo(b));
940
940
  }
941
941
  /**
942
942
  * This function will remove a leave balance from the employee's leave balance list.
@@ -944,13 +944,13 @@ class Employee {
944
944
  */
945
945
  deleteLeaveBalance(year) {
946
946
  let found = -1;
947
- this.balance.forEach((bal, i) => {
947
+ this.balances.forEach((bal, i) => {
948
948
  if (bal.year === year) {
949
949
  found = i;
950
950
  }
951
951
  });
952
952
  if (found >= 0) {
953
- this.balance.splice(found, 1);
953
+ this.balances.splice(found, 1);
954
954
  }
955
955
  }
956
956
  /**
@@ -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();
@@ -212,11 +211,7 @@ class LeaveReport extends general_1.Report {
212
211
  employeePTOHolidaySection(sheet, emp, row, year, showHoliday) {
213
212
  let annual = 0.0;
214
213
  let carry = 0.0;
215
- if (emp.name.lastname.toLowerCase() === 'erne') {
216
- console.log(JSON.stringify(emp.balance));
217
- }
218
- emp.balance.forEach(bal => {
219
- console.log(JSON.stringify(bal));
214
+ emp.balances.forEach(bal => {
220
215
  if (bal.year === year) {
221
216
  annual = bal.annual;
222
217
  carry = bal.carryover;