fix logs
This commit is contained in:
@@ -34,22 +34,23 @@ export class UserService {
|
|||||||
systemLogins: 0,
|
systemLogins: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const current = first;
|
if (logs.length > 1) {
|
||||||
while (current <= last) {
|
const current = first;
|
||||||
current.setDate(current.getDate() + 1);
|
while (current <= last) {
|
||||||
res[current.toISOString().substring(0, 10)] = {
|
current.setDate(current.getDate() + 1);
|
||||||
logins: 0,
|
res[current.toISOString().substring(0, 10)] = {
|
||||||
systemLogins: 0,
|
logins: 0,
|
||||||
};
|
systemLogins: 0,
|
||||||
}
|
};
|
||||||
|
|
||||||
logs.forEach((l) => {
|
|
||||||
if (l.type == 'login') {
|
|
||||||
res[l.timestamp.toISOString().substring(0, 10)].logins += 1;
|
|
||||||
} else if (l.type == 'systemlogin') {
|
|
||||||
res[l.timestamp.toISOString().substring(0, 10)].systemLogins += 1;
|
|
||||||
}
|
}
|
||||||
});
|
logs.forEach((l) => {
|
||||||
|
if (l.type == 'login') {
|
||||||
|
res[l.timestamp.toISOString().substring(0, 10)].logins += 1;
|
||||||
|
} else if (l.type == 'systemlogin') {
|
||||||
|
res[l.timestamp.toISOString().substring(0, 10)].systemLogins += 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Object.entries(res).map(([date, count]) => ({
|
return Object.entries(res).map(([date, count]) => ({
|
||||||
date: new Date(date),
|
date: new Date(date),
|
||||||
|
|||||||
Reference in New Issue
Block a user