From 95dbf4562513e050651555790c2ddf3e27dc53e3 Mon Sep 17 00:00:00 2001 From: luissian Date: Sat, 28 Sep 2024 16:43:54 +0200 Subject: [PATCH] Solved issue #320 ERROR multiple returned when searching for a sample --- core/utils/samples.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/utils/samples.py b/core/utils/samples.py index a2a0dbf1..051a837c 100644 --- a/core/utils/samples.py +++ b/core/utils/samples.py @@ -925,10 +925,14 @@ def get_all_sample_information(sample_id, join_values=False): molecule_id=molecule ).exists(): try: + # use the last value to avoid errors for incorrect + # used. mol_param_value.append( - core.models.MoleculeParameterValue.objects.get( + core.models.MoleculeParameterValue.objects.filter( molecule_id=molecule, molecule_parameter_id=p_name - ).get_param_value() + ) + .last() + .get_param_value() ) except core.models.MoleculeParameterValue.DoesNotExist: # if the parameter was not set at the time the molecule was handeled