Updated the vehicle/ordnance reports to accept an optional month.

master
Pacman Ghost 6 years ago
parent 1619cc23a0
commit 13c5aec065
  1. 2
      vasl_templates/webapp/__init__.py
  2. 5
      vasl_templates/webapp/templates/vo-report.html
  3. 8
      vasl_templates/webapp/vo.py

@ -41,7 +41,7 @@ if os.path.isfile( _fname ):
# load the application
import vasl_templates.webapp.main #pylint: disable=cyclic-import
import vasl_templates.webapp.vehicles_ordnance #pylint: disable=cyclic-import
import vasl_templates.webapp.vo #pylint: disable=cyclic-import
import vasl_templates.webapp.snippets #pylint: disable=cyclic-import
# initialize the application

@ -40,6 +40,7 @@ function load_vo_listings( objs )
// initialize
var nat = "{{NATIONALITY}}" ;
var year = {{YEAR}} ;
var month = {{MONTH}} ;
var $results = $("#results") ;
// check if there are any vehicles/ordnance for the specified nationality
@ -65,9 +66,9 @@ function load_vo_listings( objs )
buf.push( "<td>", fmtval(obj.no_radio) ) ;
buf.push( "<td>", fmtval(make_crew_survival(obj)) ) ;
}
var capabilities = make_capabilities( obj, year, 1, true, true ) ;
var capabilities = make_capabilities( obj, year, month, true, true ) ;
buf.push( "<td>", listval(capabilities) ) ;
var capabilities = make_capabilities( obj, year, 1, true, false ) ;
var capabilities = make_capabilities( obj, year, month, true, false ) ;
buf.push( "<td>", listval(capabilities) ) ;
buf.push( "<td>", "<span class='val'>" + fmtval(obj.note_number) + "</span>" ) ;
buf.push( "<td>", listval(obj.notes) ) ;

@ -46,8 +46,9 @@ def _do_get_listings( listings_type ):
# ---------------------------------------------------------------------
@app.route( "/<vo_type>/<nat>/<int:year>" )
def get_vo_report( nat, vo_type, year ):
@app.route( "/<vo_type>/<nat>/<int:year>", defaults={"month":1} )
@app.route( "/<vo_type>/<nat>/<int:year>/<int:month>" )
def get_vo_report( nat, vo_type, year, month ):
"""Get a vehicle/ordnance report."""
# generate the vehicle/ordnance report
@ -57,5 +58,6 @@ def get_vo_report( nat, vo_type, year ):
NATIONALITY = nat,
VO_TYPE = vo_type,
VO_TYPE0 = vo_type[:-1] if vo_type.endswith("s") else vo_type,
YEAR = year
YEAR = year,
MONTH = month
)
Loading…
Cancel
Save