glormph / kantele

Lab proteomics raw and search data management
2 stars 1 forks source link

Bug in dataset saving, cannot save samples when they already exist in db #78

Closed glormph closed 5 months ago

glormph commented 5 months ago

This happened to @happywing-KI:

Save sample sheet, where sample name for a project already exists, species and material saving goes wrong. How is this not caught by the linter, I don't know. There are at least two .pop(arg) calls on a set with an argument that I need to change to .remove(arg) here.

ESC[36mweb_1        |ESC[0m Internal Server Error: /datasets/save/samples/
ESC[36mweb_1        |ESC[0m Traceback (most recent call last):
ESC[36mweb_1        |ESC[0m   File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
ESC[36mweb_1        |ESC[0m     response = get_response(request)
ESC[36mweb_1        |ESC[0m   File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
ESC[36mweb_1        |ESC[0m     response = wrapped_callback(request, *callback_args, **callback_kwargs)
ESC[36mweb_1        |ESC[0m   File "/usr/local/lib/python3.10/contextlib.py", line 79, in inner
ESC[36mweb_1        |ESC[0m     return func(*args, **kwds)
ESC[36mweb_1        |ESC[0m   File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
ESC[36mweb_1        |ESC[0m     return view_func(request, *args, **kwargs)
ESC[36mweb_1        |ESC[0m   File "/usr/local/lib/python3.10/site-packages/django/views/decorators/http.py", line 40, in inner
ESC[36mweb_1        |ESC[0m     return func(request, *args, **kwargs)
ESC[36mweb_1        |ESC[0m   File "/kantele/datasets/views.py", line 1458, in save_samples
ESC[36mweb_1        |ESC[0m     stype_ids[fidix].pop(psam_st.sampletype_id)
ESC[36mweb_1        |ESC[0m TypeError: set.pop() takes no arguments (1 given)