Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary page throws "KeyError: 'calories'" after migration to 0.24 #127

Closed
ray66 opened this issue Jul 28, 2024 · 4 comments
Closed

Summary page throws "KeyError: 'calories'" after migration to 0.24 #127

ray66 opened this issue Jul 28, 2024 · 4 comments
Labels
component: web UI Controllers, templates and web server type: bug Something isn't working

Comments

@ray66
Copy link
Contributor

ray66 commented Jul 28, 2024

After migration to 0.24.1everything seem working except http://localhost:5000/summary/ which shows a blank page and the following message in the terminal:

[2024-07-28 09:40:09,394] ERROR in app: Exception on /summary/ [GET]
Traceback (most recent call last):
  File "/home/user/.local/pipx/venvs/geo-activity-playground/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
    return self._engine.get_loc(casted_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
  File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'calories'

I suspect this due to the fact that I have calories nowhere in ma activities.

@ray66
Copy link
Contributor Author

ray66 commented Jul 29, 2024

This error happens when metadata["calories"] and/or metadata["steps"] never get assigned a value. When I set both to 0 by default in core/activity_parsers.py::read_activity the summary page displays well.

@martin-ueding martin-ueding added type: bug Something isn't working component: web UI Controllers, templates and web server labels Jul 29, 2024
@martin-ueding
Copy link
Owner

I think I what the issue is, I've set up a fix for 0.24.2.

@martin-ueding martin-ueding added the status: ready for release Fixed but not released yet label Jul 29, 2024
@martin-ueding martin-ueding added status: testing by reporter Should be fixed, please test and report and removed status: ready for release Fixed but not released yet labels Jul 29, 2024
@antonmosich
Copy link

antonmosich commented Jul 30, 2024

The same problem also appears while generating the sharepics on the activity pages.

if activity["steps"] and not pd.isna(activity["steps"]):

This line is where it fails for me with a key error. Summary page works fine for me after the release of 0.24.2.

@martin-ueding
Copy link
Owner

Oh yes, I see the issue. I've fixed it and will upload it with the next release.

@martin-ueding martin-ueding added status: ready for release Fixed but not released yet and removed status: testing by reporter Should be fixed, please test and report status: ready for release Fixed but not released yet labels Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: web UI Controllers, templates and web server type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants