Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix linting issues

Blue Mouse7f452ed2e524
diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.ts
index 0617a9da4..38452c400 100644
--- a/src/analytics/analytics.service.ts
+++ b/src/analytics/analytics.service.ts
@@ -252,12 +252,15 @@ export class AnalyticsService {
}
validatePID(pid: string): void {
- if (_isEmpty(pid))
+ if (_isEmpty(pid)) {
throw new BadRequestException('The Project ID (pid) has to be provided')
- if (!isValidPID(pid))
+ }
+
+ if (!isValidPID(pid)) {
throw new BadRequestException(
'The provided Project ID (pid) is incorrect',
)
+ }
}
async validate(
@@ -266,8 +269,9 @@ export class AnalyticsService {
type: 'custom' | 'log' = 'log',
ip?: string,
): Promise<string | null> {
- if (_isEmpty(logDTO))
+ if (_isEmpty(logDTO)) {
throw new BadRequestException('The request cannot be empty')
+ }
const { pid } = logDTO
this.validatePID(pid)
@@ -769,7 +773,10 @@ export class AnalyticsService {
return params
}
- async calculateAverageSessionDuration(subQuery: string, paramsData: any): Promise<number> {
+ async calculateAverageSessionDuration(
+ subQuery: string,
+ paramsData: any,
+ ): Promise<number> {
const avgSdurQuery = `SELECT avg(sdur) ${subQuery} AND sdur IS NOT NULL AND unique='1'`
const avgSdurObject = await clickhouse
.query(avgSdurQuery, paramsData)
@@ -778,7 +785,11 @@ export class AnalyticsService {
return _round(avgSdurObject[0]['avg(sdur)'])
}
- generateXAxis(timeBucket: TimeBucketType, from: string, to: string): IGenerateXAxis {
+ generateXAxis(
+ timeBucket: TimeBucketType,
+ from: string,
+ to: string,
+ ): IGenerateXAxis {
let groupDateIterator
const now = dayjs.utc().endOf(timeBucket)
const djsTo = dayjs.utc(to).endOf(timeBucket)
@@ -881,7 +892,11 @@ export class AnalyticsService {
)
}
- generateAnalyticsAggregationQuery(x: string[], xM: string[], filtersQuery: string): string {
+ generateAnalyticsAggregationQuery(
+ x: string[],
+ xM: string[],
+ filtersQuery: string,
+ ): string {
let query = ''
for (let i = 0; i < _size(x); ++i) {
@@ -1184,9 +1199,9 @@ export class AnalyticsService {
async processCustomEV(query: string, params: object): Promise<object> {
const result = {}
- const rawCustoms = <Array<CustomsCHResponse>>(await clickhouse
- .query(query, params)
- .toPromise())
+ const rawCustoms = <Array<CustomsCHResponse>>(
+ await clickhouse.query(query, params).toPromise()
+ )
const size = _size(rawCustoms)
for (let i = 0; i < size; ++i) {
diff --git a/src/analytics/interfaces/index.ts b/src/analytics/interfaces/index.ts
index 45006f3a6..0ed9efc3c 100644
--- a/src/analytics/interfaces/index.ts
+++ b/src/analytics/interfaces/index.ts
@@ -45,7 +45,7 @@ export interface IGenerateXAxis {
}
export interface IExtractChartData {
- visits: number[],
- uniques: number[],
- sdur: number[],
+ visits: number[]
+ uniques: number[]
+ sdur: number[]
}