Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/controllers/adminController.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ let adminController = {
labels: ['訂閱中', '未訂閱'],
data: [users[0].dataValues.subscribeUsers, users[0].dataValues.nonsubscribeUsers],
tableName: '會員',
total: users[0].dataValues.subscribeUsers + users[0].dataValues.nonsubscribeUsers
total: Number(users[0].dataValues.subscribeUsers) + Number(users[0].dataValues.nonsubscribeUsers)
}

// adjust subscriptions data format for front-end
Expand Down
8 changes: 5 additions & 3 deletions server/controllers/ownerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ let ownerController = {
}
}]
})
if (!restaurant) return res.status(200).json({ status: 'success',meals: [], options: [], message: 'you do not have your restaurant info filled or a meal yet' })
if (!restaurant) return res.status(200).json({ status: 'success', meals: [], options: [], message: 'you do not have your restaurant info filled or a meal yet' })
let whereQuery = {}
let message = ''
if (req.query.ran !== 'thisWeek' && req.query.ran !== 'nextWeek') {
Expand Down Expand Up @@ -396,18 +396,20 @@ let ownerController = {
// query過去一個月內每日的訂單
let orders = await Order.findAll({
include: [
{ model: Meal, as: 'meals', where: { RestaurantId: restaurant.id }, attributes: ['id', 'name', 'image'] }
{ model: Meal, as: 'meals', where: { RestaurantId: restaurant.id }, attributes: [] }
],
where: {
require_date: {
[Op.gte]: pass_one_month
}
},
attributes: [
'id',
customQuery.char.date_for_dashboard,
[sequelize.literal(`COUNT(*)`), 'count']
],
group: ['date']
group: ['date'],

})
// find all dates a month from now
var dateArray = [];
Expand Down