update LastLogin on login, show it.

remove end date for filter pubs for month;
fix stats end date
This commit is contained in:
Dobromir Popov
2024-04-25 20:22:36 +03:00
parent 09c45f404b
commit af9fc6af97
3 changed files with 11 additions and 5 deletions

View File

@ -228,7 +228,7 @@ async function getAvailabilities(userId) {
}
async function filterPublishersNew(selectFields, filterDate, isExactTime = false, isForTheMonth = false, isWithStats = true, includeOldAvailabilities = false) {
async function filterPublishersNew(selectFields, filterDate, isExactTime = false, isForTheMonth = false, isNoEndDateFilter = false, isWithStats = true, includeOldAvailabilities = false) {
filterDate = new Date(filterDate); // Convert to date object if not already
@ -341,7 +341,7 @@ async function filterPublishersNew(selectFields, filterDate, isExactTime = false
{
dayOfMonth: { not: null },
startTime: { gte: monthInfo.firstMonday },
endTime: { lte: monthInfo.lastSunday }
// endTime: { lte: monthInfo.lastSunday }
},
// Check if dayOfMonth is null and match by day of week using the enum (Assigments every week)
{
@ -358,6 +358,10 @@ async function filterPublishersNew(selectFields, filterDate, isExactTime = false
]
}
};
if (!isNoEndDateFilter) { // Check if we need to apply the endTime filter
whereClause["availabilities"].some.OR[0].endTime = { lte: monthInfo.lastSunday };
}
}
console.log(`getting publishers for date: ${filterDate}, isExactTime: ${isExactTime}, isForTheMonth: ${isForTheMonth}`);