Fixing formatting of magnification

This commit is contained in:
Ian Roddis committed 2026-08-04 09:02:38 -03:00
1 parent d108cb7149
commit a617b935d3
4 files changed
+111 -25

No files matched your search

+11 -5
View File
@@ -1,11 +1,17 @@
{%- macro mag(v) -%}{{ v | int if v == v | int else v | round(1) }}{%- endmacro -%}
{%- macro magnification(info) -%}
{%- macro magnification_range(info) -%}
{%- if info and info.magnification_min is not none and info.magnification_max is not none -%}
{{ mag(info.magnification_min) }}–{{ mag(info.magnification_max) }}×
{{ mag(info.magnification_min) }}-{{ mag(info.magnification_max) }}
{%- elif info and info.magnification_min is not none -%}
{{ mag(info.magnification_min) }}×
{{ mag(info.magnification_min) }}
{%- elif info and info.magnification_max is not none -%}
{{ mag(info.magnification_max) }}×
{{ mag(info.magnification_max) }}
{%- endif -%}
{%- endmacro -%}
{%- macro magnification(info, objective_diameter_mm) -%}
{%- set range = magnification_range(info) -%}
{%- if range -%}
{{ range }}x{% if objective_diameter_mm is not none %}{{ mag(objective_diameter_mm) }}{% endif %}
{%- else -%}
<span class="muted">—</span>
{%- endif -%}
@@ -37,7 +43,7 @@
<td>{{ scope.manufacturer.name if scope.manufacturer else "—" }}</td>
<td>{{ scope.scope_model.name if scope.scope_model else "—" }}</td>
<td>{{ scope.sub_part_type.name if scope.sub_part_type else "—" }}</td>
<td>{{ magnification(info) }}</td>
<td>{{ magnification(info, row.objective_diameter_mm) }}</td>
<td>
{% if info and info.objective_thread_pitch %}
{{ info.objective_thread_pitch }}