refactor: replace ignored numeric literals with constants
This commit is contained in:
@@ -9,6 +9,9 @@ import {
|
||||
type ForecastSourceVersion,
|
||||
} from '../infrastructure/forecast.repository';
|
||||
|
||||
const MISSING_DATA_REVISION = 0;
|
||||
const STALE_FRESHNESS_MS = 0;
|
||||
|
||||
@Injectable()
|
||||
export class ForecastService {
|
||||
constructor(private readonly repository: ForecastRepository) {}
|
||||
@@ -89,7 +92,7 @@ export class ForecastService {
|
||||
data,
|
||||
meta: investmentResourceMeta({
|
||||
resourceKey: input.scopeKey,
|
||||
dataRevision: String(stored?.dataRevision ?? 0),
|
||||
dataRevision: String(stored?.dataRevision ?? MISSING_DATA_REVISION),
|
||||
availability: stored ?
|
||||
'complete' :
|
||||
dependencies.some(
|
||||
@@ -100,7 +103,7 @@ export class ForecastService {
|
||||
fetchedAt: first ? new Date(first) : null,
|
||||
freshForMs:
|
||||
data && 'positionIsStale' in data && data.positionIsStale === true ?
|
||||
0 :
|
||||
STALE_FRESHNESS_MS :
|
||||
Number.POSITIVE_INFINITY,
|
||||
work: work?.id ? { ...work, id: work.id } : null,
|
||||
dependencies,
|
||||
|
||||
Reference in New Issue
Block a user