Skip to content

Commit

Permalink
fix for dateRange filter
Browse files Browse the repository at this point in the history
  • Loading branch information
markdturner committed Sep 21, 2024
1 parent 9e46176 commit 2c525d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions src/api/timesheet/services/timesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,18 @@ module.exports = ({ strapi }) => ({
}
},
{
end: {
$between: [startDate.toISODate(), endDate.toISODate() ]
}
$or: [
{
end: {
$between: [startDate.toISODate(), endDate.toISODate() ]
}
},
{
end: {
$null: true
}
}
]
},
{
$and: [
Expand All @@ -437,7 +446,7 @@ module.exports = ({ strapi }) => ({

const timesheets = await strapi.services['api::timesheet.timesheet'].find(...args),
assignments = await strapi.services['api::assignment.assignment'].find({filters: dateRangeFilter}),
capacities = await strapi.services['api::capacity.capacity'].find({filters: { $or: [...dateRangeFilter, { end: { $null: true }} ]} }),
capacities = await strapi.services['api::capacity.capacity'].find({filters: dateRangeFilter}),
holidays = await fetchBankHolidays(args[0].filters.year.$eq),
annualLeave = await strapi.services['api::timesheet.timesheet'].leave({...args[0]})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "2024-09-21T09:02:52.009Z"
"x-generation-date": "2024-09-21T10:08:19.492Z"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down

0 comments on commit 2c525d7

Please sign in to comment.