From e324d023c3bc4d15af5fd00e6f4dcfc0e2f8b857 Mon Sep 17 00:00:00 2001 From: Bogdan Kyryliuk Date: Thu, 20 Oct 2016 16:29:03 -0700 Subject: [PATCH] Filter immune slices array stores strings. --- caravel/models.py | 6 +++--- tests/import_export_tests.py | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/caravel/models.py b/caravel/models.py index ddfdee252afeb..d48602b558694 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -506,11 +506,11 @@ def alter_positions(dashboard, old_to_new_slc_id_dict): new_slc_id = Slice.import_obj(slc, import_time=import_time) old_to_new_slc_id_dict[slc.id] = new_slc_id # update json metadata that deals with slice ids - if ('filter_immune_slices' in i_params_dict and - slc.id in i_params_dict['filter_immune_slices']): - new_filter_immune_slices.append(new_slc_id) new_slc_id_str = '{}'.format(new_slc_id) old_slc_id_str = '{}'.format(slc.id) + if ('filter_immune_slices' in i_params_dict and + old_slc_id_str in i_params_dict['filter_immune_slices']): + new_filter_immune_slices.append(new_slc_id_str) if ('expanded_slices' in i_params_dict and old_slc_id_str in i_params_dict['expanded_slices']): new_expanded_slices[new_slc_id_str] = ( diff --git a/tests/import_export_tests.py b/tests/import_export_tests.py index 4b36881e1104d..6008dc00b6c82 100644 --- a/tests/import_export_tests.py +++ b/tests/import_export_tests.py @@ -291,8 +291,11 @@ def test_import_dashboard_2_slices(self): 'dash_with_2_slices', slcs=[e_slc, b_slc], id=10003) dash_with_2_slices.json_metadata = json.dumps({ "remote_id": 10003, - "filter_immune_slices": [e_slc.id], - "expanded_slices": {e_slc.id: True, b_slc.id: False} + "filter_immune_slices": ["{}".format(e_slc.id)], + "expanded_slices": { + "{}".format(e_slc.id): True, + "{}".format(b_slc.id): False + } }) imported_dash_id = models.Dashboard.import_obj( @@ -309,7 +312,7 @@ def test_import_dashboard_2_slices(self): expected_json_metadata = { "remote_id": 10003, "import_time": 1991, - "filter_immune_slices": [i_e_slc.id], + "filter_immune_slices": ["{}".format(i_e_slc.id)], "expanded_slices": { '{}'.format(i_e_slc.id): True, '{}'.format(i_b_slc.id): False