Include player display names in generated snippets.

master
Pacman Ghost 6 years ago
parent 04d60d9887
commit eacbee6fd6
  1. 4
      vasl_templates/webapp/data/default-templates/players.j2
  2. 4
      vasl_templates/webapp/static/generate.js
  3. 4
      vasl_templates/webapp/tests/test_generate.py

@ -1,2 +1,2 @@
player1=[{{PLAYER_1}}] ; ELR=[{{PLAYER_1_ELR}}] ; SAN=[{{PLAYER_1_SAN}}]
player2=[{{PLAYER_2}}] ; ELR=[{{PLAYER_2_ELR}}] ; SAN=[{{PLAYER_2_SAN}}]
player1=[{{PLAYER_1}}:{{PLAYER_1_NAME}}] ; ELR=[{{PLAYER_1_ELR}}] ; SAN=[{{PLAYER_1_SAN}}]
player2=[{{PLAYER_2}}:{{PLAYER_2_NAME}}] ; ELR=[{{PLAYER_2_ELR}}] ; SAN=[{{PLAYER_2_SAN}}]

@ -36,6 +36,10 @@ function generate_snippet( $btn )
params.OB_SETUP_WIDTH = params.OB_SETUP_WIDTH_2 ;
}
// include the player display names
params.PLAYER_1_NAME = gNationalities[params.PLAYER_1].display_name ;
params.PLAYER_2_NAME = gNationalities[params.PLAYER_2].display_name ;
// extract the scenario date components
var scenario_date = $("input[name='SCENARIO_DATE']").datepicker( "getDate" ) ;
if ( scenario_date ) {

@ -135,7 +135,7 @@ def test_players_snippets( webapp, webdriver ):
"PLAYER_2_ELR": "3",
"PLAYER_2_SAN": "4",
},
"player1=[french] ; ELR=[1] ; SAN=[2] | player2=[british] ; ELR=[3] ; SAN=[4]",
"player1=[french:French] ; ELR=[1] ; SAN=[2] | player2=[british:British] ; ELR=[3] ; SAN=[4]",
None
)
@ -143,6 +143,6 @@ def test_players_snippets( webapp, webdriver ):
_test_snippet( webdriver, "players", {
"PLAYER_1": "british",
},
"player1=[british] ; ELR=[1] ; SAN=[2] | player2=[british] ; ELR=[3] ; SAN=[4]",
"player1=[british:British] ; ELR=[1] ; SAN=[2] | player2=[british:British] ; ELR=[3] ; SAN=[4]",
[ "Both players have the same nationality!" ],
)

Loading…
Cancel
Save