This commit is contained in:
@@ -17,6 +17,13 @@ const running = (value: unknown) =>
|
||||
(value.average === null || nonnegative(value.average)) &&
|
||||
nonnegative(value.peak) &&
|
||||
nonnegative(value.capturedHours);
|
||||
const matches = (value: unknown) =>
|
||||
record(value) &&
|
||||
['started', 'withRecordedPlayers', 'solo'].every(
|
||||
(key) => nonnegative(value[key]) && Number.isInteger(value[key])
|
||||
) &&
|
||||
(value.averageGroupSize === null || nonnegative(value.averageGroupSize)) &&
|
||||
(value.soloShare === null || (nonnegative(value.soloShare) && value.soloShare <= 100));
|
||||
const policy = (value: unknown) =>
|
||||
value === null ||
|
||||
(record(value) &&
|
||||
@@ -32,7 +39,8 @@ function validReport(value: unknown): value is MetricsData {
|
||||
!numeric(value.now) ||
|
||||
!numeric(value.since) ||
|
||||
!totals(value.summary) ||
|
||||
!running(value.running)
|
||||
!running(value.running) ||
|
||||
!matches(value.matches)
|
||||
)
|
||||
return false;
|
||||
if (
|
||||
@@ -84,6 +92,7 @@ function validReport(value: unknown): value is MetricsData {
|
||||
(item) =>
|
||||
record(item) &&
|
||||
totals(item) &&
|
||||
matches(item.matches) &&
|
||||
typeof item.game === 'string' &&
|
||||
typeof item.map === 'string' &&
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user