vtb-appit 0.1.30 → 0.1.32

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.
Files changed (2) hide show
  1. package/appit.js +16 -3
  2. package/package.json +1 -1
package/appit.js CHANGED
@@ -586,8 +586,20 @@ class Appit {
586
586
  let flight = this.clean(JSON.parse(JSON.stringify(flights[i])));
587
587
  const flightData = {...flight, excursion_id: this.history.excursionId};
588
588
  let id = this.findId('flights', flights[i].object_id);
589
- let flightModel = await this.flightModel(flights[i].flight_number, flights[i].flight_departure_date);
590
- console.log(flightModel);
589
+ try {
590
+ let flightModel = await this.flightModel(flights[i].flight_number, flights[i].flight_departure_date);
591
+ if(flightModel && flightModel.success) {
592
+ flights[i].flight_arrival_location = flightModel.data.flight_arrival_location;
593
+ flights[i].flight_departure_location = flightModel.data.flight_departure_location;
594
+ flights[i].flight_departure_time = flightModel.data.flight_departure_time;
595
+ flights[i].flight_arrival_time = flightModel.data.flight_arrival_time;
596
+ flights[i].flight_arrival_date = flightModel.data.flight_arrival_date;
597
+ } else {
598
+ flights[i].flight_live_update = 0;
599
+ }
600
+ } catch(e) {
601
+ flights[i].flight_live_update = 0;
602
+ }
591
603
 
592
604
  if(!id) {
593
605
  const model = await this.retryOperation(() => this.createFlight(flightData));
@@ -1527,7 +1539,8 @@ class Appit {
1527
1539
 
1528
1540
  async flightModel(flightNumber, flightDate)
1529
1541
  {
1530
- return await this.request('POST', `flights/get-flight-status`, {workspace_id: this.transformer.workspace_id, flight_number: flightNumber, departure_date: flightDate});
1542
+ let dateFrags = flightDate.split('-');
1543
+ return await this.request('POST', `flights/get-flight-status`, {workspace_id: this.transformer.workspace_id, flight_number: flightNumber, departure_date: `${dateFrags[2]}/${dateFrags[1]}/${dateFrags[0]}`});
1531
1544
  }
1532
1545
 
1533
1546
  async createDestination(data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtb-appit",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {},