Wire the web-scraper as a third update fallback, add regression tests
AutoUpdateAndLearn.update_data() now falls back to LottoWebUpdater (lotto.de scraping) when the API chain (Lottoland/GitHub/lottoAPI) returns no new data, matching the pattern already in production on the Eurojackpot sibling project. Required installing beautifulsoup4 into the venv - its absence would have crashed the entire update script the moment the fallback import was added, not just the fallback path itself, so this needed verifying before wiring it in. Also adds tests/test_popularity_score.py (pytest): regression coverage for the popularity/EV score against known overplayed combinations (1-2-3-4-5-6, 5-10-15-20-25-30) and the Superzahl EV ordering. Verified against the pre-fix code (commit8c2089d) that these tests would actually have caught the sum-extremity bug fixed ine05f1f1- this had previously only been caught by manual spot-checking. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
73a6b43ec9
commit
ec7290ece5
4 files changed
+135
-14
No files matched your search
@@ -27,6 +27,7 @@ project_dir = os.path.dirname(os.path.dirname(script_dir))
|
||||
sys.path.insert(0, project_dir)
|
||||
|
||||
from scripts.utils.update_from_api import LottoAPIUpdater
|
||||
from scripts.utils.update_from_web import LottoWebUpdater
|
||||
from scripts.generators.ultimate_ai_ml_hybrid_generator import UltimateAIMLHybridGenerator
|
||||
from scripts.utils.notifier import LottoNotifier
|
||||
|
||||
@@ -133,7 +134,16 @@ class AutoUpdateAndLearn:
|
||||
if success:
|
||||
print(" ✅ Daten erfolgreich aktualisiert")
|
||||
else:
|
||||
print(" ⚠️ Update ohne neue Daten")
|
||||
print(" ⚠️ API-Update ohne neue Daten, versuche Web-Scraper...")
|
||||
try:
|
||||
scraper = LottoWebUpdater(self.data_file)
|
||||
success = scraper.update(create_backup=False)
|
||||
if success:
|
||||
print(" ✅ Web-Scraper erfolgreich")
|
||||
else:
|
||||
print(" ⚠️ Web-Scraper ohne neue Daten")
|
||||
except Exception as scrape_err:
|
||||
print(f" ❌ Web-Scraper Fehler: {scrape_err}")
|
||||
|
||||
return success
|
||||
|
||||
|
||||
Reference in new issue
Block a user