Skip to content
Snippets Groups Projects

Sc204/alg in output

Merged Ghost User requested to merge SC204/alg-in-output into SC203/switch-algs
1 file
+ 18
2
Compare changes
  • Side-by-side
  • Inline
+ 18
2
@@ -164,13 +164,15 @@ class Controller:
path = self._view.ask_save_location()
mistake_results = self._model.create_mistake_frame()
delay_results = self._model.create_delay_frame()
mistake_title = self._compose_csv_title('mistakes')
delay_title = self._compose_csv_title('delay')
self._view.update_message('saved')
self._filewriter.write_frame(path,
mistake_results,
'mistakes.csv')
mistake_title)
self._filewriter.write_frame(path,
delay_results,
'delay.csv')
delay_title)
self._view.update_message('saved')
except PermissionError:
self._view.update_message('no_dir')
@@ -219,3 +221,17 @@ class Controller:
self._model.remove_task('', all=True)
self._model.analysed = False
self._view.button_status('compare', 'normal')
def _compose_csv_title(self, file_name):
"""Composes a title for a .csv file for the output of this
program.
Args:
file_name: String that will be the start of the file name
Returns:
title: String starting with file_name, then the algorithm
last used
"""
algorithm = self._model.last_used_algorithm()
title = "{}_{}.csv".format(file_name, algorithm)
return title
Loading