update LastLogin on login, show it.
remove end date for filter pubs for month; fix stats end date
This commit is contained in:
@ -68,7 +68,7 @@ function ContactsPage({ publishers, allPublishers }) {
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="border-b p-4">{pub.lastLogin ? common.getDateFormated(pub.lastLogin) : ""}</td>
|
||||
<td className="border-b p-4">{pub.lastLogin ? new Date(pub.lastLogin).toLocaleString("bg") : ""}</td>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@ -127,7 +127,7 @@ export const getServerSideProps = async (context) => {
|
||||
const prisma = common.getPrismaClient();
|
||||
const dateStr = new Date().toISOString().split('T')[0];
|
||||
|
||||
let publishers = await data.filterPublishersNew('id,firstName,lastName,email,isActive,desiredShiftsPerMonth,lastLogin', dateStr, false, true, true);
|
||||
let publishers = await data.filterPublishersNew('id,firstName,lastName,email,isActive,desiredShiftsPerMonth,lastLogin', dateStr, false, true, true, true);
|
||||
|
||||
// const axios = await axiosServer(context);
|
||||
// const { data: publishers } = await axios.get(`api/?action=filterPublishers&assignments=true&availabilities=true&date=${dateStr}&select=id,firstName,lastName,isActive,desiredShiftsPerMonth`);
|
||||
@ -160,6 +160,7 @@ export const getServerSideProps = async (context) => {
|
||||
}
|
||||
}
|
||||
});
|
||||
publisher.lastLogin = publisher.lastLogin ? publisher.lastLogin.toISOString() : null;
|
||||
//remove availabilities that isFromPreviousAssignment
|
||||
publisher.availabilities = publisher.availabilities.filter(availability => !availability.isFromPreviousAssignment);
|
||||
|
||||
@ -214,6 +215,7 @@ export const getServerSideProps = async (context) => {
|
||||
publisher.currentMonthAssignments = countAssignments(publisher.assignments, currentMonthStart, currentMonthEnd);
|
||||
publisher.previousMonthAssignments = countAssignments(publisher.assignments, previousMonthStart, previousMonthEnd);
|
||||
|
||||
publisher.lastLogin = publisher.lastLogin ? publisher.lastLogin.toISOString() : null;
|
||||
// Convert date formats within the same iteration
|
||||
convertShiftDates(publisher.assignments);
|
||||
});
|
||||
|
Reference in New Issue
Block a user