jacob-macleod / Dolphin-Flashcard-App

http://www.dolphinflashcards.com
MIT License
1 stars 3 forks source link

Unhandled exception on calculate_streak endpoint #94

Open jaymeklein opened 3 months ago

jaymeklein commented 3 months ago

While testing the calculate_streak endpoint, i faced the following exception:

  File "Flashcard-App\backend\routes\api\statistics.py", line 203, in calculate_streak
    last_streak = stats["lastStreak"]
                  ^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Testing with valid data, it returns a proper {'success': True} message, i had no problems with valid data.

But when it comes to testing with non-existent data, userID in this case, shouldn't the endpoint return something like "User not found" or {'success': False}?

jacob-macleod commented 3 months ago

Thanks, I'll look at this when I next have time