turf-common 1.2.1-beta.24 → 1.2.1-beta.26

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.
@@ -102,10 +102,10 @@ var ChargesModel = /** @class */ (function () {
102
102
  };
103
103
  ChargesModel.prototype.modify = function (bookingModification) {
104
104
  var oldBookingCode = bookingModification.oldBookingCode, newBookingCode = bookingModification.newBookingCode, cancellationUnit = bookingModification.cancellationUnit;
105
- this.totalBookingHours =
106
- this.totalBookingHours -
107
- oldBookingCode.getTotalTime("hr") +
108
- (newBookingCode ? newBookingCode.getTotalTime("hr") : 0);
105
+ // this.totalBookingHours =
106
+ // this.totalBookingHours -
107
+ // oldBookingCode.getTotalTime("hr") +
108
+ // (newBookingCode ? newBookingCode.getTotalTime("hr") : 0);
109
109
  if (!newBookingCode) {
110
110
  return this.modifyDelete(oldBookingCode, cancellationUnit !== null && cancellationUnit !== void 0 ? cancellationUnit : "");
111
111
  }
@@ -125,7 +125,11 @@ var ChargesModel = /** @class */ (function () {
125
125
  return null;
126
126
  };
127
127
  ChargesModel.prototype.modifyExtend = function (oldBookingCode, newBookingCode) {
128
+ var newTotalBookingHours = this.totalBookingHours -
129
+ oldBookingCode.getTotalTime("hr") +
130
+ (newBookingCode ? newBookingCode.getTotalTime("hr") : 0);
128
131
  var newChargeModel = this.clone();
132
+ newChargeModel.totalBookingHours = newTotalBookingHours;
129
133
  newChargeModel.additionalBookingGrossAmount +=
130
134
  newBookingCode.getCost() - oldBookingCode.getCost();
131
135
  newChargeModel.netTotal = newChargeModel.getNetAmount();
@@ -141,7 +145,11 @@ var ChargesModel = /** @class */ (function () {
141
145
  return newChargeModel;
142
146
  };
143
147
  ChargesModel.prototype.modifyReduce = function (oldBookingCode, newBookingCode, cancellationUnit) {
148
+ var newTotalBookingHours = this.totalBookingHours -
149
+ oldBookingCode.getTotalTime("hr") +
150
+ (newBookingCode ? newBookingCode.getTotalTime("hr") : 0);
144
151
  var newChargeModel = this.clone();
152
+ newChargeModel.totalBookingHours = newTotalBookingHours;
145
153
  newChargeModel.couponCode = "";
146
154
  var costDifference = oldBookingCode.getCost() - newBookingCode.getCost();
147
155
  // console.log(`costDifference ${costDifference}`);
@@ -163,7 +171,11 @@ var ChargesModel = /** @class */ (function () {
163
171
  return newChargeModel;
164
172
  };
165
173
  ChargesModel.prototype.modifyMove = function (oldBookingCode, newBookingCode, cancellationUnit) {
174
+ var newTotalBookingHours = this.totalBookingHours -
175
+ oldBookingCode.getTotalTime("hr") +
176
+ (newBookingCode ? newBookingCode.getTotalTime("hr") : 0);
166
177
  var newChargeModel = this.clone();
178
+ newChargeModel.totalBookingHours = newTotalBookingHours;
167
179
  var costDifference = newBookingCode.getCost() - oldBookingCode.getCost();
168
180
  if (costDifference === 0) {
169
181
  return newChargeModel;
@@ -193,7 +205,9 @@ var ChargesModel = /** @class */ (function () {
193
205
  return that;
194
206
  };
195
207
  ChargesModel.prototype.modifyDelete = function (bookingCode, cancellationUnit) {
208
+ var newTotalBookingHours = this.totalBookingHours - bookingCode.getTotalTime("hr");
196
209
  var newChargeModel = this.clone();
210
+ newChargeModel.totalBookingHours = newTotalBookingHours;
197
211
  newChargeModel.couponCode = "";
198
212
  var costDifference = bookingCode.getCost();
199
213
  newChargeModel.cancelledBookingGrossAmount += costDifference;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.24",
3
+ "version": "1.2.1-beta.26",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",