res.render(`orders`, {
isOrders: true,
orders: orders.map(o => {
return {
...o._doc,
price: o.courses.reduce((total, c) => {
return total += c.count * c.course.price
}, 0)
}
})