scheduler-node-models 1.2.37 → 1.2.39

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.37",
3
+ "version": "1.2.39",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -44,7 +44,7 @@ class ExcelRow {
44
44
  return -1;
45
45
  }
46
46
  toString() {
47
- let result = `${this.date.toDateString()} - `;
47
+ let result = `${this.date.toDateString()} - ${this.employee} - `;
48
48
  if (this.code !== '') {
49
49
  result += `${this.code} `;
50
50
  if (this.code.toLowerCase() === 'h') {
@@ -54,7 +54,7 @@ class ExcelRow {
54
54
  else {
55
55
  result += `${this.chargeNumber}/${this.extension}`;
56
56
  }
57
- result += `- ${this.hours.toFixed(2)}`;
57
+ result += ` - ${this.hours.toFixed(2)}`;
58
58
  return result;
59
59
  }
60
60
  }
@@ -1,9 +1,9 @@
1
- import { Team } from "../teams";
1
+ import { ITeam, Team } from "../teams";
2
2
  import { ExcelRow } from "./excelRow";
3
3
  export declare class SAPIngest {
4
4
  files: File[];
5
- teamid: string;
6
5
  team: Team;
7
- constructor(files?: File[], team?: string);
6
+ constructor(files?: File[], team?: ITeam);
7
+ Process(): Promise<ExcelRow[]>;
8
8
  processFile(file: File): Promise<ExcelRow[]>;
9
9
  }
@@ -6,12 +6,22 @@ const excelRow_1 = require("./excelRow");
6
6
  const exceljs_1 = require("exceljs");
7
7
  class SAPIngest {
8
8
  files;
9
- teamid;
10
9
  team;
11
10
  constructor(files, team) {
12
11
  this.files = (files) ? files : [];
13
- this.teamid = (team) ? team : '';
14
- this.team = new teams_1.Team();
12
+ this.team = (team) ? new teams_1.Team(team) : new teams_1.Team();
13
+ }
14
+ async Process() {
15
+ const result = [];
16
+ if (this.files.length > 0) {
17
+ const allfiles = this.files.map(async (file, f) => {
18
+ const results = await this.processFile(file);
19
+ result.push(...results);
20
+ });
21
+ await Promise.allSettled(allfiles);
22
+ }
23
+ result.sort((a, b) => a.compareTo(b));
24
+ return result;
15
25
  }
16
26
  async processFile(file) {
17
27
  const result = [];
@@ -54,7 +64,7 @@ class SAPIngest {
54
64
  dataCols.forEach(sCol => {
55
65
  const col = columns.get(sCol);
56
66
  if (col) {
57
- const sValue = row.getCell(col).toString();
67
+ const sValue = row.getCell(col).toString().trim();
58
68
  switch (sCol) {
59
69
  case 'date':
60
70
  eRow.date = new Date(Date.parse(sValue));