scheduler-node-models 1.2.107 → 1.2.108

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.107",
3
+ "version": "1.2.108",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -37,4 +37,11 @@ export declare class Site implements ISite {
37
37
  * @returns A numeric value for the relative position of this site to another.
38
38
  */
39
39
  compareTo(other?: Site): number;
40
+ /**
41
+ * This method will provide a list of labor codes active during the period provided.
42
+ * @param start The start date of the period
43
+ * @param end The ending date of the period
44
+ * @returns A list of active labor codes for the period.
45
+ */
46
+ getCurrentLaborCodes(start: Date, end: Date): LaborCode[];
40
47
  }
@@ -73,5 +73,35 @@ class Site {
73
73
  }
74
74
  return -1;
75
75
  }
76
+ /**
77
+ * This method will provide a list of labor codes active during the period provided.
78
+ * @param start The start date of the period
79
+ * @param end The ending date of the period
80
+ * @returns A list of active labor codes for the period.
81
+ */
82
+ getCurrentLaborCodes(start, end) {
83
+ const result = [];
84
+ this.forecasts.forEach(fcst => {
85
+ if ((start.getTime() >= fcst.startDate.getTime()
86
+ && start.getTime() <= fcst.endDate.getTime())
87
+ || (end.getTime() >= fcst.startDate.getTime()
88
+ && end.getTime() <= fcst.endDate.getTime())) {
89
+ fcst.laborCodes.forEach(lc => {
90
+ let found = false;
91
+ result.forEach(rlc => {
92
+ if (rlc.chargeNumber === lc.chargeNumber
93
+ && rlc.extension === lc.extension) {
94
+ found = true;
95
+ }
96
+ });
97
+ if (!found) {
98
+ result.push(new labor_1.LaborCode(lc));
99
+ }
100
+ });
101
+ }
102
+ });
103
+ result.sort((a, b) => a.compareTo(b));
104
+ return result;
105
+ }
76
106
  }
77
107
  exports.Site = Site;