format
This commit is contained in:
1 parent
ef61a63da0
commit
d242382abf
2 files changed
+1
-5
No files matched your search
@@ -146,10 +146,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
|||||||
return { monitors: this.mapDocuments(monitors), deletedCount };
|
return { monitors: this.mapDocuments(monitors), deletedCount };
|
||||||
};
|
};
|
||||||
|
|
||||||
findMonitorsSummaryByTeamId = async (
|
findMonitorsSummaryByTeamId = async (teamId: string, config?: SummaryConfig): Promise<MonitorsSummary> => {
|
||||||
teamId: string,
|
|
||||||
config?: SummaryConfig
|
|
||||||
): Promise<MonitorsSummary> => {
|
|
||||||
const match: FilterQuery<MonitorDocument> = { teamId: new mongoose.Types.ObjectId(teamId) };
|
const match: FilterQuery<MonitorDocument> = { teamId: new mongoose.Types.ObjectId(teamId) };
|
||||||
if (config?.type !== undefined) {
|
if (config?.type !== undefined) {
|
||||||
match.type = Array.isArray(config.type) ? { $in: config.type } : config.type;
|
match.type = Array.isArray(config.type) ? { $in: config.type } : config.type;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type { Check, GroupedCheck, NormalizedCheck, NormalizedUptimeCheck } from "@/types/index.js";
|
import type { Check, GroupedCheck, NormalizedCheck, NormalizedUptimeCheck } from "@/types/index.js";
|
||||||
|
|
||||||
|
|
||||||
const calculatePercentile = (arr: Check[], percentile: number): number => {
|
const calculatePercentile = (arr: Check[], percentile: number): number => {
|
||||||
const sorted = arr.slice().sort((a, b) => a.responseTime - b.responseTime);
|
const sorted = arr.slice().sort((a, b) => a.responseTime - b.responseTime);
|
||||||
const index = (percentile / 100) * (sorted.length - 1);
|
const index = (percentile / 100) * (sorted.length - 1);
|
||||||
|
|||||||
Reference in new issue
Block a user