guidopetri / chess-pipeline

Pulling games from the Lichess API into a PostgreSQL database for data analysis.
GNU General Public License v3.0
20 stars 2 forks source link

Fix EloByWeekday relying on other categories of games #69

Open guidopetri opened 2 years ago

guidopetri commented 2 years ago

If someone played a category X of games, but we try running the email pipeline with Y category, the pipeline will still find games and not trigger the "you didn't play" message. Instead, it raises an error. Full log:

A task failed when running. Most likely run() raised an exception.

Name: EloByWeekday

Parameters:
  player  : <redacted>
  columns : []
  category: blitz

Command line:
  /home/user/.local/bin/luigi --module newsletter SendNewsletter --player <redacted> --receiver <redacted>

Runtime error:
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/luigi/worker.py", line 191, in run
    new_deps = self._run_get_new_deps()
  File "/home/user/.local/lib/python3.8/site-packages/luigi/worker.py", line 133, in _run_get_new_deps
    task_gen = self.task.run()
  File "/home/user/chess-pipeline/src/newsletter.py", line 113, in run
    max_elo = int(elo['max'].max())
ValueError: cannot convert float NaN to integer