diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 98d9663b2..ac30f147a 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 7.4.0 +current_version = 7.4.1 commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P[A-z0-9-]+) diff --git a/api/server.py b/api/server.py index eeb1dc5b4..cd8df4fee 100644 --- a/api/server.py +++ b/api/server.py @@ -25,7 +25,7 @@ from db.python.utils import get_logger # This tag is automatically updated by bump2version -_VERSION = '7.4.0' +_VERSION = '7.4.1' logger = get_logger() diff --git a/db/project.xml b/db/project.xml index 97a067300..69c863e08 100644 --- a/db/project.xml +++ b/db/project.xml @@ -643,7 +643,7 @@ diff --git a/deploy/python/version.txt b/deploy/python/version.txt index ba7f754d0..815da58b7 100644 --- a/deploy/python/version.txt +++ b/deploy/python/version.txt @@ -1 +1 @@ -7.4.0 +7.4.1 diff --git a/models/models/analysis.py b/models/models/analysis.py index d4945c6d0..273d8bd1a 100644 --- a/models/models/analysis.py +++ b/models/models/analysis.py @@ -4,7 +4,7 @@ from pydantic import BaseModel -from models.base import SMBase, parse_sql_dict +from models.base import SMBase, parse_sql_bool, parse_sql_dict from models.enums import AnalysisStatus from models.utils.cohort_id_format import ( cohort_id_format_list, @@ -64,7 +64,7 @@ def from_db(**kwargs): timestamp_completed=timestamp_completed, project=kwargs.get('project'), meta=meta, - active=bool(kwargs.get('active')), + active=parse_sql_bool(kwargs.get('active')), author=kwargs.get('author'), ) diff --git a/setup.py b/setup.py index dd677c070..f511e92fa 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name=PKG, # This tag is automatically updated by bump2version - version='7.4.0', + version='7.4.1', description='Python API for interacting with the Sample API system', long_description=readme, long_description_content_type='text/markdown', diff --git a/test/test_analysis.py b/test/test_analysis.py index 850e9d608..919802168 100644 --- a/test/test_analysis.py +++ b/test/test_analysis.py @@ -2,6 +2,7 @@ import time from test.testbase import DbIsolatedTest, run_as_sync +from api.routes.analysis import AnalysisUpdateModel, update_analysis from db.python.filters import GenericFilter from db.python.layers.analysis import AnalysisLayer from db.python.layers.assay import AssayLayer @@ -17,6 +18,7 @@ ParticipantUpsertInternal, SampleUpsertInternal, SequencingGroupUpsertInternal, + parse_sql_bool, ) @@ -323,3 +325,36 @@ async def test_update_analysis(self): ] self.assertEqual(analyses, expected) + + @run_as_sync + async def test_route_update_active(self): + """ + Test that update_analysis(active=False) is effective + """ + analysis_id = await self.al.create_analysis( + AnalysisInternal( + type='cram', + status=AnalysisStatus.COMPLETED, + sequencing_group_ids=[self.genome_sequencing_group_id], + ) + ) + + analyses = await self.connection.connection.fetch_all('SELECT * FROM analysis') + self.assertEqual(1, len(analyses)) + self.assertEqual(analysis_id, analyses[0]['id']) + self.assertTrue(parse_sql_bool(analyses[0]['active'])) + + inactivate = AnalysisUpdateModel(active=False, status=AnalysisStatus.COMPLETED) + await update_analysis(analysis_id, inactivate, self.connection) + + analyses = await self.connection.connection.fetch_all('SELECT * FROM analysis') + self.assertEqual(1, len(analyses)) + self.assertEqual(analysis_id, analyses[0]['id']) + self.assertFalse(parse_sql_bool(analyses[0]['active'])) + + analyses = await self.al.query( + AnalysisFilter(project=GenericFilter(eq=self.project_id)) + ) + self.assertEqual(1, len(analyses)) + self.assertEqual(analysis_id, analyses[0].id) + self.assertFalse(analyses[0].active) diff --git a/web/package.json b/web/package.json index f0d4845bd..8586f5476 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "metamist", - "version": "7.4.0", + "version": "7.4.1", "private": true, "dependencies": { "@apollo/client": "^3.7.3",