fix: Prevent validation from running during stats command
- Remove validation logic from calculate_tax_yearly_average() - Add _auto_download_missing_monthly_data() for silent auto-download - Fix duplicate validation code in CLI that caused unintended execution - Separate validation from calculation: --stats only calculates, --validate only validates - Maintain auto-download functionality for missing data in calculations - Ensure stats command shows only calculation results without validation output Root Cause: Validation code was embedded in tax calculation function and duplicated in CLI Solution: Extract validation from calculation, keep auto-download separate Result: --stats shows clean output, --validate provides full analysis Testing: ✅ Stats command clean, ✅ Validation command works, ✅ No type errors
This commit is contained in:
30
src/cli.py
30
src/cli.py
@@ -556,36 +556,6 @@ def main():
|
||||
print(
|
||||
f"'Jednotný kurz' pro daňové účely podle metodiky ČNB pro {currency_code} za rok {year} nebyl nalezen."
|
||||
)
|
||||
debug_print("HIT: Validation condition")
|
||||
print("VALIDATION: Condition matched!")
|
||||
# Validation command
|
||||
base_threshold = args.change_threshold
|
||||
adaptive = not args.no_adaptive
|
||||
|
||||
if args.currency:
|
||||
# Validate specific currency
|
||||
debug_print(f"Validuji data pro měnu {args.currency}...")
|
||||
results = data_validator.validate_currency_data(
|
||||
args.currency, args.year, base_threshold, adaptive
|
||||
)
|
||||
|
||||
if args.json:
|
||||
output_json(results)
|
||||
else:
|
||||
text_output = data_validator.format_validation_text(results)
|
||||
print(text_output)
|
||||
else:
|
||||
# Validate all currencies
|
||||
debug_print("Validuji data pro všechny měny...")
|
||||
results = data_validator.validate_all_currencies(
|
||||
args.year, base_threshold, adaptive
|
||||
)
|
||||
|
||||
if args.json:
|
||||
output_json(results)
|
||||
else:
|
||||
text_output = data_validator.format_validation_text(results)
|
||||
print(text_output)
|
||||
elif args.currency and not args.get_rate:
|
||||
# Pokud je zadána měna, ale není zadán --get-rate, vytiskneme poslední dostupný kurz
|
||||
# Toto musí být až po --stats, jinak by se --stats nikdy nevykonalo
|
||||
|
||||
Reference in New Issue
Block a user