Skip to content

Commit

Permalink
Filter immune slices array stores strings. (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkyryliuk authored Oct 25, 2016
1 parent 89df2fc commit 7c59337
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = (
Expand Down
9 changes: 6 additions & 3 deletions tests/import_export_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit 7c59337

Please sign in to comment.