fix shidfs popup, maybe found a working do-it-all publishers data API functoin (ToDo: implement separate and simple fns if it does not work)
This commit is contained in:
@ -147,14 +147,16 @@ export default async function handler(req, res) {
|
||||
res.status(200).json(events);
|
||||
|
||||
case "getPublisherInfo":
|
||||
let pubs = await filterPublishers("id,firstName,lastName,email".split(","), "", null, req.query.assignments || true, req.query.availabilities || true, false, req.query.id);
|
||||
|
||||
// let pubs = await filterPublishers("id,firstName,lastName,email".split(","), "", null, req.query.assignments || true, req.query.availabilities || true, false, req.query.id);
|
||||
let pubs = await dataHelper.filterPublishersNew("id,firstName,lastName,email,isActive,assignments,availabilities", day, false, true, false, true, false, req.query.id, true);
|
||||
let pub = pubs[0] || {};
|
||||
if (pub) {
|
||||
let dayOfWeekQuery = common.getDayOfWeek(day);
|
||||
|
||||
pub.availabilities = pub.availabilities.map(avail => {
|
||||
if (avail.dayOfMonth == null) {
|
||||
let dayOfWeek = common.getDayOfWeek(avail.startTime);
|
||||
let dayOfWeek = common.getDayOfWeekIndex(avail.dayofweek);
|
||||
let newStart = new Date(day);
|
||||
newStart = addDays(newStart, dayOfWeek - dayOfWeekQuery);
|
||||
newStart.setHours(avail.startTime.getHours(), avail.startTime.getMinutes(), 0, 0);
|
||||
|
@ -996,9 +996,9 @@ async function RankPublishersForShiftWeighted(publishers, scheduledPubsPerDayAnd
|
||||
|
||||
// Log the scores and penalties of the top publisher
|
||||
if (ranked.length > 0) {
|
||||
console.log(`Top Publisher: ${ranked[0].name}`);
|
||||
console.log(`Score: ${ranked[0].score}`);
|
||||
console.log(`Penalties:`, ranked[0].penalties);
|
||||
console.log(`Top Publisher: ${ranked[0].firstName} ${ranked[0].lastName}`,
|
||||
` Score: ${ranked[0].score}`, "last score: ", ranked[ranked.length - 1].score,
|
||||
` Penalties: `, ranked[0].penalties);
|
||||
}
|
||||
|
||||
return ranked;
|
||||
|
Reference in New Issue
Block a user