scheduler-node-models 1.2.85 → 1.2.87

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.2.85",
3
+ "version": "1.2.87",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -21,5 +21,5 @@ export declare class ExcelRowIngest {
21
21
  * @returns A list of labor codes that can be assigned to an employee.
22
22
  */
23
23
  getForecast(date: Date): Promise<LaborCode[]>;
24
- readExcelRow(row: Row, c: number, colDate: Date, emp: Employee): Promise<ExcelRow[]>;
24
+ readCell(row: Row, c: number, colDate: Date, emp: Employee): Promise<ExcelRow>;
25
25
  }
@@ -61,10 +61,10 @@ class ExcelRowIngest {
61
61
  const emp = this.site.employees.find(e => e.name.getLastFirst().toLowerCase() === name.toLowerCase());
62
62
  if (emp) {
63
63
  const rowPromises = monthDates.map(async (day, d) => {
64
- const results = await this.readExcelRow(row, d + 3, day, emp);
65
- results.forEach(eRow => {
66
- result.push(new excelRow_1.ExcelRow(eRow));
67
- });
64
+ const results = await this.readCell(row, d + 3, day, emp);
65
+ if (results.hours >= 0.0) {
66
+ result.push(results);
67
+ }
68
68
  });
69
69
  await Promise.allSettled(rowPromises);
70
70
  }
@@ -101,8 +101,8 @@ class ExcelRowIngest {
101
101
  });
102
102
  return laborcodes;
103
103
  }
104
- async readExcelRow(row, c, colDate, emp) {
105
- const answer = [];
104
+ async readCell(row, c, colDate, emp) {
105
+ let answer = new excelRow_1.ExcelRow;
106
106
  // create test patterns for hours, if value doesn't match the hours pattern, it will
107
107
  // be assumed to be a leave code
108
108
  const hPattern = "^[0-9]{1,2}(\.[0-9]+)?$";
@@ -137,7 +137,7 @@ class ExcelRowIngest {
137
137
  eRow.extension = laborcode.extension;
138
138
  eRow.premium = '1';
139
139
  eRow.hours = Number(sValue);
140
- answer.push(eRow);
140
+ answer = new excelRow_1.ExcelRow(eRow);
141
141
  }
142
142
  }
143
143
  else {
@@ -151,12 +151,12 @@ class ExcelRowIngest {
151
151
  eRow.employee = emp.companyinfo.employeeid;
152
152
  eRow.code = wc.id;
153
153
  eRow.hours = emp.getStandardWorkday(colDate);
154
- answer.push(eRow);
154
+ answer = new excelRow_1.ExcelRow(eRow);
155
155
  }
156
156
  });
157
157
  }
158
158
  }
159
- console.log(`Answer: ${answer.length}`);
159
+ console.log(JSON.stringify(answer));
160
160
  return answer;
161
161
  }
162
162
  }