All the calculations should be in the model, not in the view. The view should only display the data prepared by the model.