Skip to content

Commit

Permalink
update aisle detection
Browse files Browse the repository at this point in the history
  • Loading branch information
its-felix committed Nov 3, 2024
1 parent f973f27 commit 8b8372d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions go/api/web/seatmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ func isLeftOfAisle(i int, details []lufthansa.SeatDetail) bool {
}

sd := details[i]
if sd.HasCharacteristic(lufthansa.SeatCharacteristicExitRow) {
// ignore for exit row, those tend to be special
if sd.HasCharacteristic(lufthansa.SeatCharacteristicExitRow) || isFirstOrLastRowWithinCabin(i, details) {
// ignore for exit/first/last row, those tend to be special
return false
} else if !sd.AisleAccess() {
return false
Expand All @@ -446,6 +446,15 @@ func isSameRow(i int, row lufthansa.JsonStrAsInt, details []lufthansa.SeatDetail
return details[i].Location.Row.Number == row
}

func isFirstOrLastRowWithinCabin(i int, details []lufthansa.SeatDetail) bool {
if i < 0 || i >= len(details) {
return false
}

row := details[i].Location.Row.Number
return details[0].Location.Row.Number == row || details[len(details)-1].Location.Row.Number == row
}

func isNextToAisle(i int, details []lufthansa.SeatDetail) bool {
if i < 0 || i >= len(details) {
return true
Expand Down

0 comments on commit 8b8372d

Please sign in to comment.