Skip to content

How to add a new statistic

Alexandre Henrique Afonso Campos edited this page Mar 16, 2019 · 5 revisions

When running python3 src/index.py, every .html file that starts with stat- is going to be listed in the main page. So what it takes is to create a file with the content of the statistics named stat-{foo}.html.

This is the process followed is order to use the automated page creation available. Every file that starts with stat- in src/ generates a page with statistics (a stat-{foo}.html).

  1. Create a python3 program and name it src/stat-{foo}.py
  2. This file must produce a dictionary out containing at least a keys named title and table
  3. table is a list of lists and must contain the statistics info.
  4. title is self explanatory, but it's also going to be used to create a link on the main page (index).
  5. out might also contain the keys labels (for the table), subtitle, explanation
  6. Call the function build_results from build_page.py and run build_results(stat, args) where stat is the dictionary mentioned, args = sys.argv.
  7. If you run python3 stat-{foo}.py page=true, a page will be created inside pages/. Else, statistics are going to be shown in terminal.
Clone this wiki locally