-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
убрана бизнес логика, фильтры, скипы
- Loading branch information
1 parent
3a8d88e
commit 89d0479
Showing
2 changed files
with
20 additions
and
295 deletions.
There are no files selected for viewing
70 changes: 2 additions & 68 deletions
70
structs/fare/masterPricerTravelBoardSearch/v14.3/response/filterBySegments.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,15 @@ | ||
package Fare_MasterPricerTravelBoardSearchResponse_v14_3 | ||
|
||
import ( | ||
search "github.com/tmconsulting/amadeus-golang-sdk/structs/fare/masterPricerTravelBoardSearch" | ||
|
||
structsCommon "github.com/tmconsulting/amadeus-golang-sdk/structs" | ||
) | ||
|
||
// GroupOfFlights Group Of Flights | ||
type FilterGroupOfFlights struct { | ||
// InternalGroupOfFlights Group Of Flights | ||
type InternalGroupOfFlights struct { | ||
ItineraryID int | ||
GroupOfSegmentsID int | ||
Flights []*structsCommon.Flight | ||
MajorityCarrier string | ||
//ElapseFlyingTime string | ||
Duration int | ||
} | ||
|
||
// FilterRules Filter Rules | ||
type FilterRules struct { | ||
Itineraries []*search.Itinerary | ||
OnlyNonStopFlight bool | ||
Airlines []string | ||
//ExcludedAirlines []string | ||
} | ||
|
||
// CheckRulesCompanies returns true if validating company's rules | ||
func (filterRules *FilterRules) CheckRulesCompanies(flight *structsCommon.Flight) bool { | ||
|
||
//for _, excludedAirline := range filterRules.ExcludedAirlines { | ||
// if excludedAirline == flight.OperatingAirline { | ||
// return false | ||
// } | ||
// if excludedAirline == flight.MarketingAirline { | ||
// return false | ||
// } | ||
//} | ||
if len(filterRules.Airlines) > 0 { | ||
var flag = false | ||
for _, airline := range filterRules.Airlines { | ||
if airline == flight.OperatingAirline.CodeEng { | ||
flag = true | ||
} | ||
if airline == flight.MarketingAirline.CodeEng { | ||
flag = true | ||
} | ||
} | ||
return flag | ||
} | ||
|
||
return true | ||
} | ||
|
||
// CheckRulesTimes Check Rules Times | ||
func (filterRules *FilterRules) CheckRulesTimes(itineraryIndex int, isDeparture, isArrival bool, segment *structsCommon.Flight) bool { | ||
|
||
//var itinerary = filterRules.Itineraries[itineraryIndex] | ||
// | ||
//if isDeparture { | ||
// var departureDateStart = itinerary.DepartureDate.Date | ||
// if !departureDateStart.Equal(segment.DepartureDate) && !departureDateStart.Before(segment.DepartureDate) { | ||
// return false | ||
// } | ||
// | ||
// if itinerary.DepartureDateTill.Error == nil { | ||
// var departureDateEnd = itinerary.DepartureDateTill.Date | ||
// if !departureDateEnd.Equal(segment.DepartureDate) && !departureDateEnd.After(segment.DepartureDate) { | ||
// return false | ||
// } | ||
// } | ||
//} | ||
// | ||
//if isArrival && itinerary.ArrivalDate.Error == nil { | ||
// var arrivalDate = itinerary.ArrivalDate.Date | ||
// if !arrivalDate.Equal(segment.ArrivalDate) && !arrivalDate.After(segment.ArrivalDate) { | ||
// return false | ||
// } | ||
//} | ||
|
||
return true | ||
} |
Oops, something went wrong.