for (var i = 0; i < len; ++i)
{
if ( !data.Flight.hasOwnProperty(i) ) {
continue;
}
var
segm_data = data.Flight[i].Segment
, suppliers = get_supplier(segm_data)
, flight_start_time = segm_data[0].Departure.attributes.Time
, flight_end_time = segm_data[0].Arrival.attributes.Time
, departure = segm_data[0].Departure.attributes
, arrival = segm_data[0].Arrival.attributes
;
var
dep_all_time = arrival.Date.split('-').reverse().join('-')+' '+arrival.Time
, arr_all_time = departure.Date.split('-').reverse().join('-')+' '+departure.Time
, flight_time = moment(dep_all_time).diff(arr_all_time,'seconds')
;
if (
(time2minutes(flight_start_time) < parseInt(this.filter.data.time.departure.start))
|| (time2minutes(flight_start_time) > parseInt(this.filter.data.time.departure.end))
|| (time2minutes(flight_end_time) < parseInt(this.filter.data.time.departure_back.start))
|| (time2minutes(flight_end_time) > parseInt(this.filter.data.time.departure_back.end))
|| flight_time > parseInt(this.filter.data.time.flight)*60
|| !in_array_array(suppliers,this.filter.data.airlines)
) {
status = false;
break;
}
}
// Было
for (var i=0;i<len;i++) {
if (data.Flight.hasOwnProperty(i)) {
// ...
}
}
// Стало
for (var i=0;i<len;i++) if (data.Flight.hasOwnProperty(i)) {
// ...
}
// Было
for (var i=0;i<flights.search_result.Air.length;i++) {
if (flights.search_result.Air.hasOwnProperty(i)) {
// ...
}
}
// Стало
for (var i=0;i<flights.search_result.Air.length;i++) {
if (!flights.search_result.Air.hasOwnProperty(i)) continue;
// ...
}
var segm_data = data.Flight[i].Segment[0];
var flight_start_time = time2minutes(segm_data.Departure.attributes.Time);