Hi there! Try this instead:
let discouragedDuration = await data.flatMap { $0.activitySegments }.flatMap { $0.categories }.flatMap { $0.applications }.reduce(0, {$0 + $1.totalActivityDuration})
Not sure why this approach actually takes the filter into account, but my guess is that the filter doesn't apply as high up as the activitySegments level. Hope this works for you; it did for me.
Topic:
App & System Services
SubTopic:
General
Tags: