diff --git a/src/ert/gui/tools/plot/data_type_proxy_model.py b/src/ert/gui/tools/plot/data_type_proxy_model.py index fec4e242803..8450bd021a7 100644 --- a/src/ert/gui/tools/plot/data_type_proxy_model.py +++ b/src/ert/gui/tools/plot/data_type_proxy_model.py @@ -27,15 +27,14 @@ def filterAcceptsRow(self, source_row: int, source_parent: QModelIndex) -> bool: for meta_key, values in self._metadata_filters.items(): for value, visible in values.items(): if ( - ( - not visible - and meta_key in key.metadata - and key.metadata[meta_key] == value + not visible + and ( + meta_key in key.metadata and key.metadata[meta_key] == value ) - or not visible - and key.history_vector + or (value == "History Vector" and key.history_vector) ): - show = False + return False + return show def sourceModel(self) -> DataTypeKeysListModel: diff --git a/tests/unit_tests/gui/plottery/test_plotting_of_snake_oil.py b/tests/unit_tests/gui/plottery/test_plotting_of_snake_oil.py index 02c554afa90..f4fc1ecd47b 100644 --- a/tests/unit_tests/gui/plottery/test_plotting_of_snake_oil.py +++ b/tests/unit_tests/gui/plottery/test_plotting_of_snake_oil.py @@ -142,9 +142,11 @@ def test_that_all_plotter_filter_boxes_yield_expected_filter_results( key_list = plot_window.findChild(DataTypeKeysWidget).data_type_keys_widget item_count = [3, 10, 45] - assert key_list.model().rowCount() == sum(item_count) + cbs = plot_window.findChildren(QCheckBox, "FilterCheckBox") + history_filter = cbs[3] + cbs = cbs[0:3] for i in range(len(item_count)): for u, cb in enumerate(cbs): @@ -152,4 +154,9 @@ def test_that_all_plotter_filter_boxes_yield_expected_filter_results( assert key_list.model().rowCount() in item_count + # test history vector filtering + assert key_list.model().rowCount() == 45 + history_filter.setChecked(False) + assert key_list.model().rowCount() == 24 + plot_window.close()