scheduler-node-models 1.2.21 → 1.2.22

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.21",
3
+ "version": "1.2.22",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -167,6 +167,7 @@ export declare class Employee implements IEmployee {
167
167
  * @param start The date object used to mark the start of the assignment
168
168
  */
169
169
  addAssignment(site: string, wkctr: string, start: Date): void;
170
+ addVariation(site: string, start: Date): void;
170
171
  /**
171
172
  * The function will remove a particular assignment from the assignment list
172
173
  * @param id The numeric identifier for the assignment to remove.
@@ -565,6 +565,23 @@ class Employee {
565
565
  }
566
566
  this.assignments.push(newAsgmt);
567
567
  }
568
+ addVariation(site, start) {
569
+ // start by getting and determing the next variation id number.
570
+ let newID = -1;
571
+ this.variations.forEach(vari => {
572
+ if (vari.id > newID) {
573
+ newID = vari.id;
574
+ }
575
+ });
576
+ newID++;
577
+ const newVari = new variation_1.Variation();
578
+ newVari.id = newID;
579
+ newVari.site = site;
580
+ newVari.startdate = new Date(start);
581
+ newVari.enddate = new Date(start);
582
+ this.variations.push(newVari);
583
+ this.variations.sort((a, b) => a.compareTo(b));
584
+ }
568
585
  /**
569
586
  * The function will remove a particular assignment from the assignment list
570
587
  * @param id The numeric identifier for the assignment to remove.