diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js
index 7dfb6da..4192c6c 100644
--- a/vasl_templates/webapp/static/snippets.js
+++ b/vasl_templates/webapp/static/snippets.js
@@ -25,6 +25,7 @@ var MA_NOTE_REDIRECTS = {
"Jp": "japanese",
"Ru": "russian",
"US": "american",
+ "LC": "landing-craft",
"AllM": "allied-minor",
"AxM": "axis-minor",
} ;
@@ -414,7 +415,7 @@ function get_vo_note_key( vo_entry )
if ( ! vo_entry.note_number )
return null ;
// NOTE: There are some note numbers of the form "1.2" :-/ We also need to handle redirects.
- var match = vo_entry.note_number.match( new RegExp( "^((Br|US|Fr) )?([0-9]+(.\\d)?)" ) ) ;
+ var match = vo_entry.note_number.match( new RegExp( "^((Br|US|Fr|LC) )?([0-9]+(.\\d)?)" ) ) ;
if ( ! match )
return null ;
var key = match[0] ;
@@ -429,7 +430,7 @@ function get_vo_note( vo_type, nat, key )
return null ;
// check for redirects
- var match = key.match( /^(Br|US|Fr) (.+)$/ ) ;
+ var match = key.match( /^(Br|US|Fr|LC) (.+)$/ ) ;
if ( match ) {
nat = MA_NOTE_REDIRECTS[ match[1] ] ;
key = match[2] ;
diff --git a/vasl_templates/webapp/tests/fixtures/data/vehicles/japanese.json b/vasl_templates/webapp/tests/fixtures/data/vehicles/japanese.json
index 6b16785..06cb83c 100644
--- a/vasl_templates/webapp/tests/fixtures/data/vehicles/japanese.json
+++ b/vasl_templates/webapp/tests/fixtures/data/vehicles/japanese.json
@@ -1,6 +1,7 @@
[
{ "name": "japanese vehicle",
+ "note_number": "2",
"notes": [ "A\u20201" ],
"id": "ja/v:000"
}
diff --git a/vasl_templates/webapp/tests/fixtures/data/vehicles/landing-craft.json b/vasl_templates/webapp/tests/fixtures/data/vehicles/landing-craft.json
index e6b5047..54ac820 100644
--- a/vasl_templates/webapp/tests/fixtures/data/vehicles/landing-craft.json
+++ b/vasl_templates/webapp/tests/fixtures/data/vehicles/landing-craft.json
@@ -6,6 +6,7 @@
"gpid": [ 399, 397 ]
},
{ "name": "Daihatsu",
+ "note_number": "2",
"notes": [ "B" ],
"id": "sh/v:007",
"gpid": 417
diff --git a/vasl_templates/webapp/tests/fixtures/vo-notes/japanese/vehicles/2.html b/vasl_templates/webapp/tests/fixtures/vo-notes/japanese/vehicles/2.html
new file mode 100644
index 0000000..02b2a2f
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/vo-notes/japanese/vehicles/2.html
@@ -0,0 +1 @@
+Japanese Vehicle Note #2.
diff --git a/vasl_templates/webapp/tests/fixtures/vo-notes/landing-craft/2.html b/vasl_templates/webapp/tests/fixtures/vo-notes/landing-craft/2.html
new file mode 100644
index 0000000..11b28b2
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/vo-notes/landing-craft/2.html
@@ -0,0 +1 @@
+Landing Craft Note #2.
diff --git a/vasl_templates/webapp/tests/test_vo_notes.py b/vasl_templates/webapp/tests/test_vo_notes.py
index 86638d1..5b9cff5 100644
--- a/vasl_templates/webapp/tests/test_vo_notes.py
+++ b/vasl_templates/webapp/tests/test_vo_notes.py
@@ -208,6 +208,13 @@ def test_common_vo_notes2( webapp, webdriver ):
( "common allied minor vehicle", "vehicles/allied-minor/note/101" ),
] )
+ # restore "show vehicle/ordnance notes as images"
+ select_menu_option( "user_settings" )
+ elem = find_child( ".ui-dialog.user-settings input[name='vo-notes-as-images']" )
+ assert elem.is_selected()
+ elem.click()
+ click_dialog_button( "OK" )
+
# ---------------------------------------------------------------------
def test_extra_ma_notes( webapp, webdriver ):
@@ -286,6 +293,31 @@ def test_extra_ma_notes( webapp, webdriver ):
# ---------------------------------------------------------------------
+def test_landing_craft_notes( webapp, webdriver ):
+ """Test handling of Landing Craft notes."""
+
+ # initialize
+ init_webapp( webapp, webdriver, scenario_persistence=1,
+ reset = lambda ct: ct.set_vo_notes_dir( dtype="test" )
+ )
+
+ # load the test scenario
+ load_scenario( {
+ "PLAYER_1": "japanese",
+ "OB_VEHICLES_1": [
+ { "name": "japanese vehicle" },
+ { "name": "Daihatsu" },
+ ],
+ } )
+
+ # check the vehicle notes
+ _check_vo_snippets( 1, "vehicles", [
+ "japanese vehicle:
\nJapanese Vehicle Note #2.\n |
",
+ "Daihatsu: \nLanding Craft Note #2.\n |
",
+ ] )
+
+# ---------------------------------------------------------------------
+
def test_update_ui( webapp, webdriver ):
"""Check that the UI is updated correctly for multi-applicable notes."""
diff --git a/vasl_templates/webapp/vo.py b/vasl_templates/webapp/vo.py
index 6e1f5e3..aa4ee47 100644
--- a/vasl_templates/webapp/vo.py
+++ b/vasl_templates/webapp/vo.py
@@ -43,7 +43,7 @@ def load_vo_listings():
"ordnance": _do_load_vo_listings( "ordnance", True, False )
}
-def _do_load_vo_listings( vo_type, merge_common, report ): #pylint: disable=too-many-locals,too-many-branches
+def _do_load_vo_listings( vo_type, merge_common, report ): #pylint: disable=too-many-locals,too-many-branches,too-many-statements
"""Load the vehicle/ordnance listings."""
# locate the data directory
@@ -97,6 +97,11 @@ def _do_load_vo_listings( vo_type, merge_common, report ): #pylint: disable=too-
# add in any landing craft
if vo_type == "vehicles":
for lc in listings.get("landing-craft",[]):
+ # FUDGE! Landing Craft get appended to the vehicles for the Japanese/American/British,
+ # so we need to tag the note numbers so that they refer to the *Landing Craft* note,
+ # not the Japanese/American/British vehicle note.
+ if "note_number" in lc:
+ lc["note_number"] = "LC {}".format( lc["note_number"] )
if lc["name"] in ("Daihatsu","Shohatsu"):
listings["japanese"].append( lc )
else: