fix
This commit is contained in:
@@ -24,8 +24,8 @@ export class UserService {
|
|||||||
order: { timestamp: 'asc' },
|
order: { timestamp: 'asc' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const first = logs[0].timestamp;
|
const first = new Date(logs[0].timestamp.toISOString());
|
||||||
const last = logs[logs.length - 1].timestamp;
|
const last = logs[logs.length - 1].timestamp.toISOString().substring(0, 10);
|
||||||
|
|
||||||
const res = {};
|
const res = {};
|
||||||
|
|
||||||
@@ -36,13 +36,15 @@ export class UserService {
|
|||||||
|
|
||||||
if (logs.length > 1) {
|
if (logs.length > 1) {
|
||||||
const current = first;
|
const current = first;
|
||||||
while (current <= last) {
|
|
||||||
current.setDate(current.getDate() + 1);
|
while (current.toISOString().substring(0, 10) <= last) {
|
||||||
res[current.toISOString().substring(0, 10)] = {
|
res[current.toISOString().substring(0, 10)] = {
|
||||||
logins: 0,
|
logins: 0,
|
||||||
systemLogins: 0,
|
systemLogins: 0,
|
||||||
};
|
};
|
||||||
|
current.setDate(current.getDate() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
logs.forEach((l) => {
|
logs.forEach((l) => {
|
||||||
if (l.type == 'login') {
|
if (l.type == 'login') {
|
||||||
res[l.timestamp.toISOString().substring(0, 10)].logins += 1;
|
res[l.timestamp.toISOString().substring(0, 10)].logins += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user