diff --git a/src/api/rse/services/rse.js b/src/api/rse/services/rse.js index 6d61a5a..e5bac64 100644 --- a/src/api/rse/services/rse.js +++ b/src/api/rse/services/rse.js @@ -356,6 +356,14 @@ module.exports = createCoreService("api::rse.rse", ({ strapi }) => ({ end: { $between: [startDate.toISODate(), endDate.toISODate() ] } + }, + { + start: { + $lt: startDate.toISODate() + }, + end: { + $gt: endDate.toISODate() + } } ] } @@ -456,12 +464,22 @@ module.exports = createCoreService("api::rse.rse", ({ strapi }) => ({ let day = { date: date.toISODate(), - day: date.day, - month: date.month, - year: date.year, - dayOfWeek: date.weekday, - isWeekend: date.weekday > 5, - capacity: dateCapacity, + metadata: { + day: date.day, + month: date.month, + year: date.year, + dayOfWeek: date.weekday, + isWeekend: date.weekday > 5 + }, + utilisation: { + capacity: dateCapacity, + allocated: currentAssignments.reduce((total, assignment) => total + assignment.fte, 0), + unallocated: dateCapacity - currentAssignments.reduce((total, assignment) => total + assignment.fte, 0), + recorded: { + billable: timesheetSummary.reduce((total, timesheet) => total + (timesheet.billable ? timesheet.duration : 0), 0), + nonBillable: timesheetSummary.reduce((total, timesheet) => total + (timesheet.billable ? 0 : timesheet.duration), 0) + } + }, holiday: holiday ? holiday : null, leave: leaveDay ? { type: leaveDay.TYPE, duration: leaveDay.DURATION, status: leaveDay.STATUS } : null, assignments: currentAssignments, diff --git a/src/extensions/documentation/documentation/1.0.0/full_documentation.json b/src/extensions/documentation/documentation/1.0.0/full_documentation.json index 8b2b33a..8782441 100644 --- a/src/extensions/documentation/documentation/1.0.0/full_documentation.json +++ b/src/extensions/documentation/documentation/1.0.0/full_documentation.json @@ -14,7 +14,7 @@ "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "x-generation-date": "2024-08-23T13:12:47.118Z" + "x-generation-date": "2024-08-23T21:16:04.397Z" }, "x-strapi-config": { "path": "/documentation",