diff --git a/emgapi/models.py b/emgapi/models.py index 02f9cd51c..ae8194666 100644 --- a/emgapi/models.py +++ b/emgapi/models.py @@ -424,7 +424,6 @@ def available(self, request): 'latitude': "CAST(latitude as DECIMAL(10,5))" } ) \ - .annotate(runs_count=Count('runs')) \ .prefetch_related( Prefetch('studies', queryset=_qs2), Prefetch('biome', queryset=Biome.objects.all()), diff --git a/emgapi/serializers.py b/emgapi/serializers.py index ffd5efcfa..8bced1aab 100644 --- a/emgapi/serializers.py +++ b/emgapi/serializers.py @@ -635,34 +635,15 @@ def get_studies(self, obj): def get_runs(self, obj): return None - # counters - runs_count = serializers.IntegerField() - class Meta: model = emg_models.Sample - fields = ( - 'url', - 'runs_count', - 'accession', - 'biosample', - 'analysis_completed', - 'collection_date', - 'geo_loc_name', - 'longitude', - 'latitude', - 'sample_desc', - 'environment_biome', - 'environment_feature', - 'environment_material', - 'sample_name', - 'sample_alias', - 'host_tax_id', - 'species', - 'last_update', - 'biome', - 'studies', - 'runs', - 'sample_metadata' + exclude = ( + 'primary_accession', + 'is_public', + 'metadata_received', + 'sequencedata_received', + 'sequencedata_archived', + 'submission_account_id', ) diff --git a/tests/integration/test_examples.py b/tests/integration/test_examples.py index 187b8be6c..b266e08c9 100644 --- a/tests/integration/test_examples.py +++ b/tests/integration/test_examples.py @@ -54,7 +54,6 @@ def test_list(self, live_server, runs, api_version): study.bioproject, sample.accession, sample.biome.biome_name, - sample.runs_count, run.accession, run.experiment_type, ) diff --git a/tests/integration/test_sample.py b/tests/integration/test_sample.py index 91f108b6b..a82a0359e 100644 --- a/tests/integration/test_sample.py +++ b/tests/integration/test_sample.py @@ -38,7 +38,7 @@ def test_details(self, client, sample): assert rsp['data']['type'] == "samples" assert rsp['data']['id'] == "ERS01234" _attr = rsp['data']['attributes'] - assert(len(_attr) == 18) + assert(len(_attr) == 17) assert _attr['accession'] == "ERS01234" assert _attr['biosample'] == "SAMS01234" assert _attr['sample-desc'] == "abcdefghijklmnoprstuvwyz"