new column (filterable for push notificaitons status

This commit is contained in:
Dobromir Popov
2024-05-12 19:00:11 +03:00
parent d528c5c6ee
commit 6e884777fb
2 changed files with 25 additions and 2 deletions

View File

@ -346,7 +346,6 @@ async function filterPublishersNew(selectFields, filterDate, isExactTime = false
}
}
console.log(`getting publishers for date: ${filterDate}, isExactTime: ${isExactTime}, isForTheMonth: ${isForTheMonth}`);
console.log`whereClause: ${JSON.stringify(whereClause)}`
//include availabilities if flag is true
@ -532,6 +531,7 @@ async function getAllPublishersWithStatistics(filterDate, noEndDateFilter = fals
desiredShiftsPerMonth: true,
lastLogin: true,
type: true,
pushSubscription: true,
assignments: {
select: {
id: true,
@ -575,6 +575,8 @@ async function getAllPublishersWithStatistics(filterDate, noEndDateFilter = fals
allPublishers.forEach(publisher => {
publisher.isPushActive = publisher.pushSubscription ? true : false;
delete publisher.pushSubscription
// Use helper functions to calculate and assign assignment counts
publisher.currentMonthAssignments = countAssignments(publisher.assignments, monthInfo.firstMonday, monthInfo.lastSunday);
publisher.previousMonthAssignments = countAssignments(publisher.assignments, prevMonthInfo.firstMonday, prevMonthInfo.lastSunday);