diff --git a/backend/services/dailyReport/dailyReport.js b/backend/services/dailyReport/dailyReport.js index 3b8257c..47d3a9d 100644 --- a/backend/services/dailyReport/dailyReport.js +++ b/backend/services/dailyReport/dailyReport.js @@ -6,15 +6,21 @@ const { getDaily } = require('../../endpoints/rota/scheduleLogic'); * @param {import('mongodb').Db} db */ module.exports = async (db) => { - // Get all the reports from today - const startOfDay = new Date().setHours(0, 0, 0, 0); - const endOfDay = new Date().setHours(23, 59, 59, 999); + // Get all the reports since the last daily report + const now = new Date(); + + const start = new Date(now); + start.setDate(start.getDate() - 1); + start.setHours(11, 0, 0, 0); + + const end = new Date(now); + end.setHours(10, 59, 59, 999); // Check to see if a report exists already and if one does exit out const reportExists = await db.collection('overviewReport').findOne({ date: { - $gte: startOfDay, - $lte: endOfDay + $gte: start, + $lte: end } }); diff --git a/frontend/app/components/Overview.jsx b/frontend/app/components/Overview.jsx index aac42c9..d82203a 100644 --- a/frontend/app/components/Overview.jsx +++ b/frontend/app/components/Overview.jsx @@ -250,7 +250,7 @@ export default function Overview() { {report.missing.map((element) => (
{/* Status */}