Hi all,
I have an app which saves Locations
into an array in my model. I then have a computed property on my model for calculating the active time. This depends on Date
, which I am working to extract into the environment for testing purposes.
My question is this: How should I handle this? Should I convert the computed property into a function (Date) -> TimeInterval
? If I do that, then I need to pass in the date whenever I want the active time. This would be fine, except that I have many other similar computed properties and even methods on my model which I call from within reducers, all of which depend on the environment. Should I start passing the environment in to my model on init? Is that an anti pattern? Or should I get rid of all these methods on my model and simply perform the mutations directly within my reducer?
Thanks for the help everyone!
Kristo