diff --git a/app/db/logs.js b/app/db/logs.js index 5e4154a..289b1a4 100644 --- a/app/db/logs.js +++ b/app/db/logs.js @@ -164,6 +164,8 @@ exports.getMonthlyCountsByService = (date, filter) => { exports.getWeeklyCountsByService = (date, len, filter) => { logger.trace(); logger.debug("TODO implement filter"); + filter['overview'] = 1; + filter['tokens_incl'] = 1; const {query, values, table} = createFilter(filter,2); return new promise((resolve, reject) => { const days_list = ` @@ -251,7 +253,7 @@ function createFilter(filter, add=1){ if('service_id' in filter) { values.push(filter['service_id']); query += ' AND service_id = $'+ (values.length+add) +' '; - } else { + } else if(!('overview' in filter)){ query += ' AND service_id IS NULL '; } return { diff --git a/app/routes/viewRoutes.js b/app/routes/viewRoutes.js index 2916952..bcecb9a 100644 --- a/app/routes/viewRoutes.js +++ b/app/routes/viewRoutes.js @@ -236,14 +236,14 @@ router.post('/add-token', function (req, res, next) { async function getAdminDashboard(user, res){ - const len = 21; + const len = 28; const last_date = (new Date).toISOString().slice(0,10); const weekly = await adminController.getWeeklyCountsByService(last_date, len); res.render('dashboard', {user: user, servicecounts: weekly, period_length: len, date: Date.parse(last_date), initialview: (new Date).toISOString().slice(0,7), admin_dashboard_active: true,type: 'user', filter: 'all', datalines: ["units", "requests", "body_bytes_sent"]}); } async function getUserDashboard(user, res){ - const len = 21; + const len = 28; const last_date = (new Date).toISOString().slice(0,10); const weekly = await userController.getWeeklyCountsByService(user.user_id, last_date , len); res.render('dashboard', {user: user, servicecounts: weekly, period_length: len, date: Date.parse(last_date), initialview: (new Date).toISOString().slice(0,7), user_dashboard_active: true, type: 'user', filter: user.user_id, datalines: ["units", "requests", "body_bytes_sent"]});