Skip to content

Commit dd02b87

Browse files
committed
fix: treat colon-only return ranges as no filter
1 parent 845bdbd commit dd02b87

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎scripts/update-data.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,14 @@ export function parseAumRange(value: string): Range | undefined {
486486
return { min, max };
487487
}
488488

489-
function parseRanges(env: Record<string, string | undefined>, prefix: 'PERFORMANCE' | 'TOTAL_RETURN'): RangeMap {
489+
export function parseRanges(env: Record<string, string | undefined>, prefix: 'PERFORMANCE' | 'TOTAL_RETURN'): RangeMap {
490490
const result: RangeMap = {};
491491
for (const period of ['YTD', '1Y', '3Y', '5Y', '10Y'] as ReturnPeriod[]) {
492492
const value = env[`${prefix}_${period}`];
493-
if (value !== undefined && value.trim() !== '') result[period] = parseRange(value, `${prefix}_${period}`);
493+
if (value !== undefined && value.trim() !== '') {
494+
const parsed = parseRange(value, `${prefix}_${period}`);
495+
if (parsed) result[period] = parsed;
496+
}
494497
}
495498
return result;
496499
}
@@ -500,11 +503,11 @@ function readTickerSet(value: string | undefined): Set<string> | null {
500503
return tickers.length ? new Set(tickers) : null;
501504
}
502505

503-
function hasConfiguredFilters(config: UpdaterConfig): boolean {
506+
export function hasConfiguredFilters(config: UpdaterConfig): boolean {
504507
return Boolean(config.aum || config.ter || config.dividendYield || config.tickers || Object.keys(config.performance).length || Object.keys(config.totalReturn).length);
505508
}
506509

507-
function readConfig(env: Record<string, string | undefined> = process.env): UpdaterConfig {
510+
export function readConfig(env: Record<string, string | undefined> = process.env): UpdaterConfig {
508511
return {
509512
maxFetches: parsePositiveInt(env.MAX_FETCHES, 0),
510513
requestSleep: parseDecimal(env.REQUEST_SLEEP, 1.5),

0 commit comments

Comments
 (0)