fast-aircraft-design / FAST-OAD

FAST-OAD: An open source framework for rapid Overall Aircraft Design
GNU General Public License v3.0
47 stars 25 forks source link

MissionViewer fix and source file generation #477

Closed florentLutz closed 1 year ago

florentLutz commented 1 year ago

This PR adds a feature and fixes a bug:

codecov[bot] commented 1 year ago

Codecov Report

Merging #477 (9530612) into master (7fb9de6) will decrease coverage by 0.32%. The diff coverage is 74.48%.

:exclamation: Current head 9530612 differs from pull request most recent head b847d19. Consider uploading reports for the commit b847d19 to get more accurate results

@@            Coverage Diff             @@
##           master     #477      +/-   ##
==========================================
- Coverage   83.13%   82.81%   -0.32%     
==========================================
  Files         119      119              
  Lines        5253     5324      +71     
  Branches      811      828      +17     
==========================================
+ Hits         4367     4409      +42     
- Misses        739      767      +28     
- Partials      147      148       +1     
Impacted Files Coverage Δ
src/fastoad/api.py 100.00% <ø> (ø)
src/fastoad/gui/mission_viewer.py 43.47% <12.00%> (-56.53%) :arrow_down:
src/fastoad/module_management/_plugins.py 90.16% <89.65%> (-0.10%) :arrow_down:
src/fastoad/cmd/api.py 92.30% <100.00%> (+0.58%) :arrow_up:
src/fastoad/cmd/cli.py 86.31% <100.00%> (+1.60%) :arrow_up:
src/fastoad/module_management/exceptions.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

florentLutz commented 1 year ago

did you check if the MissionViewer is able to show several missions, as it was before?

I did not checked how it looked like in FAST-OAD_CS25 and thought by looking at the code that only the first mission added would be displayed. Thinking that, I added a way to choose which mission to display, which was in fact unnecessary.

With this commit it does the same as before (with the update of the graph).

florentLutz commented 1 year ago

As you suggested, I changed all mention I could find of source file to source data file. The other big part in the latest commit is the refactoring of generate_configuration_file and generate_source_data_file. For both of them the function _generate_user_file is used (I used the term user file as a generic for configuration and source data file). I wonder if using an if/else statement depending on the type of user file is the right approach. Nonetheless, it has the merit of being clear but some lines could be spared by using a dictionary translating user file type into the associated functions (_list and _info)