diff --git a/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py index 33ebfb94dcc975d0942115f56dc190dbd402ee2a..7bf3f9212dbcfcc81bc86995bc164e07b94375a7 100644 --- a/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py +++ b/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py @@ -12,7 +12,7 @@ from sohstationviewer.view.plotting.plotting_widget.plotting_widget import ( PlottingWidget) from sohstationviewer.view.util.enums import LogType from sohstationviewer.view.util.functions import ( - replace_actual_quest_chans, remove_not_found_chans) + replace_actual_question_chans, remove_not_found_chans) from sohstationviewer.controller.util import display_tracking_info from sohstationviewer.controller.plotting_data import get_title @@ -120,7 +120,7 @@ class MultiThreadedPlottingWidget(PlottingWidget): """ chan_order = self.pref_order if self.pref_order \ else sorted(list(plotting_data.keys())) - chan_order = replace_actual_quest_chans( + chan_order = replace_actual_question_chans( chan_order, plotting_data.keys()) chan_order = remove_not_found_chans( chan_order, plotting_data.keys(), self.processing_log) diff --git a/sohstationviewer/view/util/functions.py b/sohstationviewer/view/util/functions.py index 4d3ea6d2dbf8f89a085ff6be4e346f1ece12411c..72a7d069a95c1349c8e2965878aa5492cde96ae4 100644 --- a/sohstationviewer/view/util/functions.py +++ b/sohstationviewer/view/util/functions.py @@ -347,7 +347,7 @@ def remove_not_found_chans( return [c for c in chan_order if c not in not_found_chans] -def replace_actual_quest_chans( +def replace_actual_question_chans( chan_order: List[str], actual_chans: List[str]) -> List[str]: """ Remove channels end with '?' from chan_order and replace with corresponding @@ -360,12 +360,13 @@ def replace_actual_quest_chans( """ question_chans = [c for c in chan_order if c.endswith('?')] for qc in question_chans: - actual_quest_chans = [c for c in list(actual_chans) - if qc[:-1] == c[:-1]] - if actual_quest_chans: - quest_idx = chan_order.index(qc) + actual_question_chans = [c for c in list(actual_chans) + if qc[:-1] == c[:-1]] + if actual_question_chans: + question_idx = chan_order.index(qc) chan_order.remove(qc) - chan_order[quest_idx:quest_idx] = sorted(actual_quest_chans) + chan_order[question_idx:question_idx] = \ + sorted(actual_question_chans) return chan_order diff --git a/tests/test_view/test_util_functions.py b/tests/test_view/test_util_functions.py index 60fb1c205b464b201cf8378619166cc40f2713b0..8ad6187487f9eb673f656267f49908fc7ddfced9 100644 --- a/tests/test_view/test_util_functions.py +++ b/tests/test_view/test_util_functions.py @@ -10,7 +10,7 @@ from sohstationviewer.view.util.functions import ( create_search_results_file, create_table_of_content_file, check_chan_wildcards_format, check_masspos, get_total_miny_maxy, extract_netcodes, get_index_from_time, remove_not_found_chans, - replace_actual_quest_chans + replace_actual_question_chans ) from sohstationviewer.view.util.enums import LogType @@ -520,18 +520,18 @@ class RemoveNotFoundChansClass(TestCase): class ReplaceActualQuestChans(TestCase): - def test_quest_chans_in_actual_chans(self): + def test_question_chans_in_actual_chans(self): chan_order = ['A', 'B', 'C?', 'D'] actual_chans = ['C1', 'C3', 'C2', 'D', 'E', 'F'] expected_new_chan_order = ['A', 'B', 'C1', 'C2', 'C3', 'D'] - ret = replace_actual_quest_chans(chan_order, actual_chans) + ret = replace_actual_question_chans(chan_order, actual_chans) self.assertListEqual(ret, expected_new_chan_order) - def test_quest_chans_not_in_actual_chans(self): + def test_question_chans_not_in_actual_chans(self): chan_order = ['A?', 'B', 'C', 'D'] actual_chans = ['C', 'D', 'E', 'F'] expected_new_chan_order = ['A?', 'B', 'C', 'D'] - ret = replace_actual_quest_chans(chan_order, actual_chans) + ret = replace_actual_question_chans(chan_order, actual_chans) self.assertListEqual(ret, expected_new_chan_order)