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
16 changes: 11 additions & 5 deletions backend/services/dailyReport/dailyReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/Overview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export default function Overview() {
{report.missing.map((element) => (
<div
key={element.clusterId}
className="rounded-xl border border-white/10 bg-slate-800/70 p-4 shadow-sm transition hover:bg-slate-800/90"
className="rounded-xl border border-white/10 bg-slate-800/70 p-4 shadow-sm transition"
>
<div className="flex flex-col gap-4 sm:grid sm:grid-cols-3 sm:items-center">
{/* Status */}
Expand Down
Loading