initial commit
This commit is contained in:
1 parent
5729b0a263
commit
50c644231e
9 files changed
+72
-21
No files matched your search
@@ -360,16 +360,12 @@ export class MonitorService implements IMonitorService {
|
||||
const snapshotOnlyRequest =
|
||||
requestedTypes.length > 0 && requestedTypes.every((requestedType) => snapshotTypes.includes(requestedType as MonitorType));
|
||||
|
||||
const limitPerMonitor = snapshotOnlyRequest ? 1 : 25;
|
||||
const checksMap = await this.checksRepository.findLatestByMonitorIds(
|
||||
monitorsList.map((monitor) => monitor.id),
|
||||
{ limitPerMonitor }
|
||||
);
|
||||
|
||||
const monitorsWithChecks = monitorsList.map((monitor: Monitor) => {
|
||||
const rawChecks = checksMap[monitor.id] ?? [];
|
||||
const rawChecks = monitor.recentChecks ?? [];
|
||||
const isSnapshotType = snapshotOnlyRequest || snapshotTypes.includes(monitor.type);
|
||||
const checks = isSnapshotType ? rawChecks.slice(0, 1) : NormalizeData(rawChecks, 10, 100);
|
||||
// recentChecks are stored oldest-first, reverse to get newest-first for display
|
||||
const reversedChecks = [...rawChecks].reverse();
|
||||
const checks = isSnapshotType ? reversedChecks.slice(0, 1) : NormalizeData(reversedChecks, 10, 100);
|
||||
return {
|
||||
...monitor,
|
||||
checks,
|
||||
|
||||
Reference in new issue
Block a user