diff options
| -rw-r--r-- | uploader/genotypes/models.py | 3 | ||||
| -rw-r--r-- | uploader/genotypes/views.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/uploader/genotypes/models.py b/uploader/genotypes/models.py index 40afb1e..41270da 100644 --- a/uploader/genotypes/models.py +++ b/uploader/genotypes/models.py @@ -110,6 +110,9 @@ def genotype_records( with conn.cursor(cursorclass=DictCursor) as cursor: _markers, _num_records = genotype_markers( conn, species_id, population_id, offset, limit) + if len(_markers) == 0: + return (tuple(), 0) + _genoids = tuple(_marker["Id"] for _marker in _markers) cursor.execute( _query_template.replace( diff --git a/uploader/genotypes/views.py b/uploader/genotypes/views.py index 8c0795d..1eaf0dd 100644 --- a/uploader/genotypes/views.py +++ b/uploader/genotypes/views.py @@ -62,7 +62,8 @@ def index(species: dict, population: dict, **kwargs):# pylint: disable=[unused-a in enumerate(_genotype_records, start=offset+1)) ## Order these correctly - _samples = tuple(_genotype_records[0]["data"].keys()) + _samples = (tuple() if len(_genotype_records) == 0 + else tuple(_genotype_records[0]["data"].keys())) if "application/json" in request.headers["Accept"]: return make_response( |
