FAI-CIVL / FAI-Airscore

AirScore - online paragliding / hanggliding GAP-based scoring software.
https://airscore.cc/
GNU General Public License v3.0
13 stars 17 forks source link

Error trying to modify task with imported comp #177

Closed kuaka closed 3 years ago

kuaka commented 3 years ago

as mentioned in #176. In trying to delete a turpoint in task definition:

airscore_prod | [2020-11-20 20:31:51,254] ERROR in app: Exception on /users/_del_turnpoint/undefined [POST]
airscore_prod | Traceback (most recent call last):
airscore_prod |   File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
airscore_prod |     response = self.full_dispatch_request()
airscore_prod |   File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
airscore_prod |     rv = self.handle_user_exception(e)
airscore_prod |   File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
airscore_prod |     reraise(exc_type, exc_value, tb)
airscore_prod |   File "/home/sid/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
airscore_prod |     raise value
airscore_prod |   File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
airscore_prod |     rv = self.dispatch_request()
airscore_prod |   File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
airscore_prod |     return self.view_functions[rule.endpoint](**req.view_args)
airscore_prod |   File "/home/sid/.local/lib/python3.8/site-packages/flask_login/utils.py", line 272, in decorated_view
airscore_prod |     return func(*args, **kwargs)
airscore_prod |   File "/app/airscore/user/views.py", line 742, in _del_turnpoint
airscore_prod |     print(f"{data['partial_distance']}")
airscore_prod | KeyError: 'partial_distance'

brings up the bigger issue in how importing comps handle waypoints. The ideal situation would be to take the waypoints used in all tasks in an imported comp and create a specific flying area to host them. that way tasks can be re created or modified if needed.

biuti commented 3 years ago

I want to implement a logic that uses 'external' flag. As mentioned, external should be read-only, and if the flag is removed, than it will delete taskresult rows, and recalculate task distances. That should be enough. Otherwise it is difficult to understand why this happens. In my tests, that happened if there were less than two pilots landed out. Now I check and add a dummy pilot at min_dist to create the object. The rules are very poor about difficulty calc, it works only if two or more pilots are landed out, otherwise it is zero. But I did not find how to cope with the particular cases.

biuti commented 3 years ago

Ok, I just pushed a new branch, with a external comp logic and a function to transform to a fully functional one. Please have a try with that FAI sphere comp and let me know. Converting will recalculate distances and delete tracks, everything else should be there. I added a Region selection to task admin page, anyway task waypoints should still be there.

biuti commented 3 years ago

issue should have been fixed with https://github.com/FAI-CIVL/FAI-Airscore/commit/d4fece804e894be9ef6e5f39b98a55a0fffefd42. Also the infinite reload looping issue should have been solved with https://github.com/FAI-CIVL/FAI-Airscore/commit/5e0f81db3bac2b2601ee6c479eba273b2de68971