Average Price - Appropriate logic to execute in view, or better in controller?
3 answers
Ask a few questions:
Will this average price be displayed Is this part of the view (is it used to display something?) Does it need complex things to get / calculate / fetch or whatever?
If you think this is just a prompt for your user, it is only used once and you can leave it in your view.
But if you feel uncomfortable with this, or need to do more complex math on price, put it in your model.
0
a source to share