db/models:

Cleaned up the `hazard_metadata` logic.
calcs/risk/classical/core:

Fixed a `loss_ratio_curve_matrix` indexing bug in `classical()`.
db/models:

Fixed the logic in Output.hazard_metadata to handle more cases.

I'm still not sure if it covers all cases (haz output or haz calc,
loss curve or loss_map, etc.), but at least this reduces crashes during
XML serialization due to missing metadata.
calcs/risk/general:

Fixed an issue where the risk engine would create mean/quantile `Output` and
`LossCurve` records for _each hazard output associated with a realization_.
This is wrong. It should create a mean container if `mean_loss_curves = true`
and 1 quantile container for each `quantile_loss_curves`.
tests/calcs/risk/event_based/core_test:

Changed some docstrings into comments, so we don't throw garbage into the
nosetests -v output.
calcs/risk/classical_bcr/core:

Safer unpacking of `output_containers` results.
calcs/risk/event_based/core:

In `output_containers`, mean and quantiles now come at the end.
calcs/risk/event_based_bcr/core:

Safer unpacking of `output_containers` results.
tests/calcs/risk/general_test:

`create_outputs` now does NOT create means and quantiles.

Before, it was creating a bunch of extra records that weren't needed.
db/models:

Fixed an indentation error.
bin/openquake:

When printing a list of outputs, order by output_type
tests/data/end-to-end-hazard-risk:

Added a pair of hazard/risk demos to test end-to-end calculation functionality
and ensure that outputs can be generated and exported properly.
tests:

Renamed `helpers.get_risk_job` to `helpers.get_fake_risk_job`.
tests/utils/helpers:

Wrapped a line which is too long.
tests/utils/helpers:

Added `run_risk_job` and `get_risk_job` util functions.
tests/export/risk_test:

Added `test_classical_risk_export`, which runs a hazard calculation and then
runs a risk calculation based on the hazard results. Then, it exports
everything to "smoketest" the exporters, which were, until recently, broken.

They were broken due to a collection of bugs strewn about the risk engine.
calcs/risk/scenario_damage/core:

`create_outputs` should actually bloody return something. Ever heard of an
interface?
qa_tests/risk/scenario_damage/case_4/test:

Fixed a spelling mistake.
qa_tests/risk:

Use `helpers.run_risk_job` to run risk calcs for QA tests. This way, it is run
in the same process so we can set breakpoints, measure code coverage, etc.
qa_tests/hazard/event_based:

s/poes_hazard_maps/poes/