diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js index ba9ab11..9feb45e 100644 --- a/vasl_templates/webapp/static/snippets.js +++ b/vasl_templates/webapp/static/snippets.js @@ -904,10 +904,12 @@ function get_ma_note( nat, vo_type, key ) if ( ! ma_note ) { // still couldn't find anything - if we're Allied/Axis Minor, try the common notes - if ( gTemplatePack.nationalities[ nat ].type === "allied-minor" ) - ma_note = get_ma_notes_for_nat( "allied-minor", vo_type )[ key ] ; - else if ( gTemplatePack.nationalities[ nat ].type === "axis-minor" ) - ma_note = get_ma_notes_for_nat( "axis-minor", vo_type )[ key ] ; + if ( gTemplatePack.nationalities[ nat ] ) { + if ( gTemplatePack.nationalities[ nat ].type === "allied-minor" ) + ma_note = get_ma_notes_for_nat( "allied-minor", vo_type )[ key ] ; + else if ( gTemplatePack.nationalities[ nat ].type === "axis-minor" ) + ma_note = get_ma_notes_for_nat( "axis-minor", vo_type )[ key ] ; + } } return ma_note ; diff --git a/vasl_templates/webapp/tests/control_tests_servicer.py b/vasl_templates/webapp/tests/control_tests_servicer.py index 547f7d5..98c633b 100644 --- a/vasl_templates/webapp/tests/control_tests_servicer.py +++ b/vasl_templates/webapp/tests/control_tests_servicer.py @@ -162,6 +162,11 @@ class ControlTestsServicer( BaseControlTestsServicer ): #pylint: disable=too-man # NOTE: The webapp has been reconfigured, but the client must reloaed the home page # with "?force-reinit=1", to force it to re-initialize with the new settings. + # NOTE: Dealing with landing craft is a major PITA, since it breaks the usual access pattern + # of "nat/vo-type". For the purpose of tests, we disable them in the back-end (so that we can + # detect problems there, as well as in the front-end), and enable them only when needed. + self.setAppConfigVal( SetAppConfigValRequest( key="_DISABLE_LANDING_CRAFT_", boolVal=True ), ctx ) + # return our capabilities to the caller caps = [] if _ORIG_CHAPTER_H_NOTES_DIR: diff --git a/vasl_templates/webapp/tests/test_vo_notes.py b/vasl_templates/webapp/tests/test_vo_notes.py index c45af16..7d2dddd 100644 --- a/vasl_templates/webapp/tests/test_vo_notes.py +++ b/vasl_templates/webapp/tests/test_vo_notes.py @@ -240,7 +240,9 @@ def test_extra_ma_notes( webapp, webdriver ): """Test handling of Landing Craft and Allied/Axis Minor common vehicles/ordnance.""" # initialize - webapp.control_tests.set_vo_notes_dir( "{TEST}" ) + webapp.control_tests \ + .set_vo_notes_dir( "{TEST}" ) \ + .set_app_config_val( "_DISABLE_LANDING_CRAFT_", False ) init_webapp( webapp, webdriver, scenario_persistence=1 ) # load the test scenario @@ -315,7 +317,9 @@ def test_landing_craft_notes( webapp, webdriver ): """Test handling of Landing Craft notes.""" # initialize - webapp.control_tests.set_vo_notes_dir( "{TEST}" ) + webapp.control_tests \ + .set_vo_notes_dir( "{TEST}" ) \ + .set_app_config_val( "_DISABLE_LANDING_CRAFT_", False ) init_webapp( webapp, webdriver, scenario_persistence=1 ) # load the test scenario @@ -342,7 +346,8 @@ def test_vo_note_image_url_path( webapp, webdriver ): webapp.control_tests \ .set_data_dir( "{TEST}" ) \ .set_vo_notes_dir( "{TEST}" ) \ - .set_default_template_pack( "vo-note-image-url-path/" ) + .set_default_template_pack( "vo-note-image-url-path/" ) \ + .set_app_config_val( "_DISABLE_LANDING_CRAFT_", False ) init_webapp( webapp, webdriver, scenario_persistence=1 ) def extract_url_path( clipboard ): @@ -572,7 +577,8 @@ def test_vo_notes_reports( webapp, webdriver ): #pylint: disable=too-many-locals webapp.control_tests \ .set_data_dir( "{REAL}" ) \ .set_vasl_version( "random", vasl_extns_type="{REAL}" ) \ - .set_vo_notes_dir( "{REAL}" ) + .set_vo_notes_dir( "{REAL}" ) \ + .set_app_config_val( "_DISABLE_LANDING_CRAFT_", False ) init_webapp( webapp, webdriver ) # initialize diff --git a/vasl_templates/webapp/vo_notes.py b/vasl_templates/webapp/vo_notes.py index 0bad827..89676cf 100644 --- a/vasl_templates/webapp/vo_notes.py +++ b/vasl_templates/webapp/vo_notes.py @@ -104,6 +104,10 @@ def load_vo_notes( msg_store ): #pylint: disable=too-many-statements,too-many-lo dname2, vo_type2 = os.path.split( dname2 ) else: extn_id = None + if app.config.get( "_DISABLE_LANDING_CRAFT_" ) and vo_type2 == "landing-craft": + # NOTE: Landing craft are usually disabled during tests (so that we can detect + # when the code has forgotten to consider them). + continue if vo_type2 not in ("vehicles","ordnance","landing-craft"): continue if os.path.split( dname2 )[1] == "tests":