Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter immune slices array stores strings. #1402

Merged
merged 1 commit into from
Oct 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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