ethanopp / fitly

Self hosted web analytics for endurance athletes
MIT License
184 stars 24 forks source link

Performance view not rendering #16

Closed spawn-github closed 3 years ago

spawn-github commented 3 years ago

Hi! After successfully refreshing my data, when attempting to view the performance view, the page does not render and the following is logged:

{"loglevel": "info", "workers": 8, "bind": "0.0.0.0:80", "workers_per_core": 2.0, "host": "0.0.0.0", "port": "80"} Exception on /_dash-update-component [POST] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "/usr/local/lib/python3.7/site-packages/dash/dash.py", line 1076, in dispatch response.set_data(func(args, outputs_list=outputs_list)) File "/usr/local/lib/python3.7/site-packages/dash/dash.py", line 1007, in add_context output_value = func(args, kwargs) # %% callback invoked %% File "/app/src/fitly/utils.py", line 87, in router_callback layout = page(kwargs) File "/app/src/fitly/pages/performance.py", line 46, in get_layout pmc_switch_settings = json.loads(athlete_info.pmc_switch_settings) File "/usr/local/lib/python3.7/json/init.py", line 341, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not NoneType

As far as I can tell, the other views I'd want to use (Home, Power) seem to be working as expected.

Appreciate the assistance to date, and as always, happy to provide any additional details.

Thanks!

ethanopp commented 3 years ago

https://github.com/ethanopp/fitly/commit/e44aa291c1aa4c2d1595af1dfab93e52a75e53e0 should fix

Delete fitness.db and refresh or if you have a sql editor you can run update athlete set pmc_switch_settings = '{"ride_status": true, "run_status": true, "all_status": true, "power_status": true, "hr_status": true, "atl_status": false}'

Thanks for all the help testing btw :D

spawn-github commented 3 years ago

Didn't want to dump the DB, so used sqlite3 to run the update SQL, and the performance view is rendering.

Thanks!