I love how stupid this project is
si units and redefining speed metric as thrust/weight ratio
This commit is contained in:
@@ -11,6 +11,7 @@ from flask import Flask, g
|
||||
|
||||
from physcom.db.schema import init_db
|
||||
from physcom.db.repository import Repository
|
||||
from physcom.units import format_quantity
|
||||
|
||||
|
||||
DEFAULT_DB = Path("data/physcom.db")
|
||||
@@ -101,6 +102,7 @@ def create_app() -> Flask:
|
||||
app.secret_key = _load_or_generate_secret_key()
|
||||
|
||||
app.jinja_env.filters["si"] = _si_format
|
||||
app.jinja_env.filters["qty"] = format_quantity
|
||||
|
||||
app.teardown_appcontext(close_db)
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<td>{{ mb.metric_name }}</td>
|
||||
<td>{{ mb.unit or '—' }}</td>
|
||||
<td>{{ mb.weight }}</td>
|
||||
<td>{{ mb.norm_min|si }}</td>
|
||||
<td>{{ mb.norm_max|si }}</td>
|
||||
<td>{{ mb.norm_min|qty(mb.unit) }}</td>
|
||||
<td>{{ mb.norm_max|qty(mb.unit) }}</td>
|
||||
<td>{{ '↓ lower' if mb.lower_is_better else '↑ higher' }}</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-sm"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
<td>{{ mb.metric_name }}</td>
|
||||
<td>{{ mb.unit }}</td>
|
||||
<td>{{ mb.weight }}</td>
|
||||
<td>{{ mb.norm_min|si }}</td>
|
||||
<td>{{ mb.norm_max|si }}</td>
|
||||
<td>{{ mb.norm_min|qty(mb.unit) }}</td>
|
||||
<td>{{ mb.norm_max|qty(mb.unit) }}</td>
|
||||
<td>{{ '↓ lower' if mb.lower_is_better else '↑ higher' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<tr>
|
||||
<td>{{ dep.category }}</td>
|
||||
<td>{{ dep.key }}</td>
|
||||
<td>{{ dep.value|si }}</td>
|
||||
<td>{{ dep.value|qty(dep.unit) }}</td>
|
||||
<td>{{ dep.unit or '—' }}</td>
|
||||
<td><span class="badge badge-{{ dep.constraint_type }}">{{ dep.constraint_type }}</span></td>
|
||||
<td class="actions">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
{% for dep in e.dependencies %}
|
||||
<tr>
|
||||
<td>{{ dep.key }}</td>
|
||||
<td>{{ dep.value|si }}{{ ' ' + dep.unit if dep.unit else '' }}</td>
|
||||
<td>{{ dep.value|qty(dep.unit) }}</td>
|
||||
<td><span class="badge badge-{{ dep.constraint_type }}">{{ dep.constraint_type }}</span></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -77,10 +77,10 @@
|
||||
<tr>
|
||||
<td>{{ s.metric_name }}</td>
|
||||
{% set unit = s.metric_unit or '' %}
|
||||
<td class="score-cell">{{ s.raw_value|si if s.raw_value is not none else '—' }}{{ ' ' + unit if unit and s.raw_value is not none else '' }}</td>
|
||||
<td class="score-cell">{{ s.raw_value|qty(unit) if s.raw_value is not none else '—' }}</td>
|
||||
<td>
|
||||
{%- if mb -%}
|
||||
{{ mb.norm_min|si }} — {{ mb.norm_max|si }}{{ ' ' + unit if unit else '' }}
|
||||
{{ mb.norm_min|qty(unit) }} — {{ mb.norm_max|qty(unit) }}
|
||||
{%- else -%}
|
||||
—
|
||||
{%- endif -%}
|
||||
|
||||
Reference in New Issue
Block a user