Files
calminer/templates/partials/reports/monte_carlo_table.html
zwitschi 795a9f99f4 feat: Enhance currency handling and validation across scenarios
- Updated form template to prefill currency input with default value and added help text for clarity.
- Modified integration tests to assert more descriptive error messages for invalid currency codes.
- Introduced new tests for currency normalization and validation in various scenarios, including imports and exports.
- Added comprehensive tests for pricing calculations, ensuring defaults are respected and overrides function correctly.
- Implemented unit tests for pricing settings repository, ensuring CRUD operations and default settings are handled properly.
- Enhanced scenario pricing evaluation tests to validate currency handling and metadata defaults.
- Added simulation tests to ensure Monte Carlo runs are accurate and handle various distribution scenarios.
2025-11-11 18:29:59 +01:00

47 lines
1.6 KiB
HTML

{% set sorted_metrics = metrics | dictsort %}
{% set ns = namespace(percentile_keys=[]) %}
{% if percentiles %}
{% set ns.percentile_keys = percentiles %}
{% elif sorted_metrics %}
{% set reference_percentiles = sorted_metrics[0][1].percentiles.keys() | list %}
{% set ns.percentile_keys = reference_percentiles %}
{% endif %}
{% if sorted_metrics %}
<table class="metrics-table">
<thead>
<tr>
<th scope="col">Metric</th>
<th scope="col">Mean</th>
{% for percentile in ns.percentile_keys %}
{% set percentile_label = '%g' % percentile %}
<th scope="col">P{{ percentile_label }}</th>
{% endfor %}
<th scope="col">Std Dev</th>
</tr>
</thead>
<tbody>
{% for metric_name, summary in sorted_metrics %}
<tr>
<th scope="row">{{ metric_name | replace('_', ' ') | title }}</th>
<td>{{ summary.mean | format_metric(metric_name, currency) }}</td>
{% for percentile in ns.percentile_keys %}
{% set percentile_key = '%g' % percentile %}
{% set percentile_value = summary.percentiles.get(percentile_key) %}
<td>
{% if percentile_value is not none %}
{{ percentile_value | format_metric(metric_name, currency) }}
{% else %}
{% endif %}
</td>
{% endfor %}
<td>{{ summary.std_dev | format_metric(metric_name, currency) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted">Monte Carlo metrics are unavailable.</p>
{% endif %}