Skip to content

Commit

Permalink
Remove breaking change, try different approach.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Fellure committed Aug 1, 2024
1 parent fd692f3 commit 9006c3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,6 @@ public protocol CTSingleDataSetProtocol: CTDataSetProtocol {

}

extension CTSingleDataSetProtocol where Self.DataPoint: CTStandardDataPointProtocol {

/// Get average for the DataSet
func average() -> Double {
dataPoints
.map(\.value)
.reduce(0, +)
.divide(by: Double(dataPoints.count))
}
}

/**
Protocol for data sets that require a multiple sets of data .
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,11 @@ extension CTMultiDataSetProtocol where Self.DataSet.DataPoint: CTStandardDataPoi
public func average() -> Double {

self.dataSets
.compactMap {
$0.average()
.compactMap { dataSet -> Double in
dataSet.dataPoints
.map(\.value)
.reduce(0, +)
.divide(by: Double(dataSet.dataPoints.count))
}
.reduce(0, +)
.divide(by: Double(self.dataSets.count))
Expand Down

0 comments on commit 9006c3f

Please sign in to comment.