Skip to content

Commit

Permalink
fix(bgtargets): correctly assigning highindex
Browse files Browse the repository at this point in the history
Signed-off-by: Sjoerd-Bo3 <sjoerd.bozon@gmail.com>
  • Loading branch information
Sjoerd-Bo3 committed Jun 17, 2024
1 parent 9be108b commit 45d1ede
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ extension TargetsEditor {
units = profile.units
items = profile.targets.map { value in
let timeIndex = timeValues.firstIndex(of: Double(value.offset * 60)) ?? 0
let highIndex = lowIndex
let lowIndex = rateValues.firstIndex(of: value.low) ?? 0
let highIndex = rateValues.firstIndex(of: value.high) ?? 0
return Item(lowIndex: lowIndex, highIndex: highIndex, timeIndex: timeIndex)
}
}
Expand Down Expand Up @@ -68,7 +68,7 @@ extension TargetsEditor {
let uniq = Array(Set(self.items))
let sorted = uniq.sorted { $0.timeIndex < $1.timeIndex }
.map { item -> Item in
Item(lowIndex: item.lowIndex, highIndex: item.lowIndex, timeIndex: item.timeIndex)
Item(lowIndex: item.lowIndex, highIndex: item.highIndex, timeIndex: item.timeIndex)
}
sorted.first?.timeIndex = 0
self.items = sorted
Expand Down

0 comments on commit 45d1ede

Please sign in to comment.