diff --git a/scripts/convert_and_dispatch_genotypes.py b/scripts/convert_and_dispatch_genotypes.py
index 18720e0..aa7959e 100644
--- a/scripts/convert_and_dispatch_genotypes.py
+++ b/scripts/convert_and_dispatch_genotypes.py
@@ -241,8 +241,8 @@ class UploadVcfToSamples(StepEPP):
             # This is the first genotyping results
             lims_sample.udf[submitted_genotype_udf_number_call] = nb_call
             lims_sample.udf[genotype_udf_file_id] = lims_file.id
-        elif lims_sample.udf.get(submitted_genotype_udf_number_call) and \
-                nb_call > lims_sample.udf.get(submitted_genotype_udf_number_call):
+        elif submitted_genotype_udf_number_call in lims_sample.udf and \
+                nb_call > (lims_sample.udf.get(submitted_genotype_udf_number_call) or 0):
             # This genotyping is better than before
             lims_sample.udf[submitted_genotype_udf_number_call] = nb_call
             lims_sample.udf[genotype_udf_file_id] = lims_file.id

ConvertGenotype does not overwrite best run = 0
In `convert_and_dispatch_genotypes.py` the overwriting of the best run UDF does not work when the best run is `0`


diff --git a/tests/test_convert_and_dispatch_genotypes.py b/tests/test_convert_and_dispatch_genotypes.py
index 3d34ed3..020c52f 100644
--- a/tests/test_convert_and_dispatch_genotypes.py
+++ b/tests/test_convert_and_dispatch_genotypes.py
@@ -170,7 +170,7 @@ class TestUploadVcfToSamples(TestEPP):
             }
             self.lims_sample2.udf = {
                 'QuantStudio Data Import Completed #': 1,
-                'Number of Calls (Best Run)': 12,
+                'Number of Calls (Best Run)': 0,
                 'Genotyping results file id': 'old_file_id'
             }
             mlims.upload_new_file.return_value = Mock(id='file_id')

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
asana==0.6.7
attrs==22.2.0
cached-property==1.5.2
certifi==2021.5.30
-e git+https://github.com/EdinburghGenomics/clarity_scripts.git@6fd2d0a0f7fc2f12213daa9f265b8c5a35e3e7ef#egg=clarity_scripts
coverage==6.2
EGCG-Core==0.8.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==2.8
MarkupSafe==2.0.1
oauthlib==3.2.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyclarity-lims==0.4.8
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
PyYAML==6.0.1
requests==2.14.2
requests-oauthlib==0.8.0
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: clarity_scripts
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - asana==0.6.7
      - attrs==22.2.0
      - cached-property==1.5.2
      - coverage==6.2
      - egcg-core==0.8.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - jinja2==2.8
      - markupsafe==2.0.1
      - oauthlib==3.2.2
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyclarity-lims==0.4.8
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - pyyaml==6.0.1
      - requests==2.14.2
      - requests-oauthlib==0.8.0
      - six==1.17.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/clarity_scripts

tests/test_convert_and_dispatch_genotypes.py::TestUploadVcfToSamples::test_upload_second_time
tests/test_convert_and_dispatch_genotypes.py::TestEPP::test_init tests/test_convert_and_dispatch_genotypes.py::TestGenotypeConversion::test_find_field tests/test_convert_and_dispatch_genotypes.py::TestGenotypeConversion::test_generate_vcf tests/test_convert_and_dispatch_genotypes.py::TestGenotypeConversion::test_get_genotype_from_call tests/test_convert_and_dispatch_genotypes.py::TestGenotypeConversion::test_order_from_fai tests/test_convert_and_dispatch_genotypes.py::TestGenotypeConversion::test_parse_QuantStudio_AIF_genotype tests/test_convert_and_dispatch_genotypes.py::TestGenotypeConversion::test_parse_genome_fai tests/test_convert_and_dispatch_genotypes.py::TestGenotypeConversion::test_vcf_header_from_ref_length tests/test_convert_and_dispatch_genotypes.py::TestUploadVcfToSamples::test_init tests/test_convert_and_dispatch_genotypes.py::TestUploadVcfToSamples::test_upload_first_time
scripts/convert_and_dispatch_genotypes.py
scripts/convert_and_dispatch_genotypes.py