Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scenarios/cbor-decoding/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ <h1>CBOR decoding</h1>
<div class="footer-line">Want to contribute? The project is <a href="https://github.com/pragma-org/node-diversity-conformance/tree/scenarios/cbor-decoding" target="_blank" rel="noopener">Open Source <svg class="gh-link" fill="currentColor" width="16" height="16" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"/></svg></a></div>
</footer>
</div>
<script src="../../js/percent.js"></script>
<script src="../../js/fit.js"></script>
<script src="scenario.js?v=54"></script>
</body>
Expand Down
7 changes: 0 additions & 7 deletions scenarios/cbor-decoding/scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ function score(outcome, category = 'all') {
return { met, expected, ratio: expected === 0 ? null : met / expected };
}

// Never round a failing node up to 100%.
function pctValue(ratio) {
if (ratio === null) return '—';
if (ratio === 1) return '100';
return Math.min(Math.floor(ratio * 10000) / 100, 99.99).toFixed(2);
}

function pct(ratio) {
return ratio === null ? '—' : `${pctValue(ratio)}%`;
}
Expand Down
3 changes: 2 additions & 1 deletion scenarios/ledger-rules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ <h1 id="title">Ledger Rules</h1>
<div class="footer-line">Want to contribute? The project is <a href="https://github.com/pragma-org/node-diversity-conformance/tree/scenarios/ledger-rules" target="_blank" rel="noopener">Open Source <svg class="gh-link" fill="currentColor" width="16" height="16" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"/></svg></a></div>
</footer>
</div>
<script src="../../js/common.js?v=3"></script>
<script src="../../js/percent.js"></script>
<script src="../../js/common.js?v=4"></script>
<script src="../../js/fit.js"></script>
<script src="scenario.js?v=8"></script>
</body>
Expand Down
3 changes: 2 additions & 1 deletion scenarios/uplc-conformance/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ <h1 id="title">UPLC functional tests</h1>
<div class="footer-line">Want to contribute? The project is <a href="https://github.com/pragma-org/node-diversity-conformance/tree/scenarios/uplc-conformance" target="_blank" rel="noopener">Open Source <svg class="gh-link" fill="currentColor" width="16" height="16" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"/></svg></a></div>
</footer>
</div>
<script src="../../js/common.js?v=3"></script>
<script src="../../js/percent.js"></script>
<script src="../../js/common.js?v=4"></script>
<script src="../../js/fit.js"></script>
<script src="scenario.js?v=10"></script>
</body>
Expand Down
3 changes: 2 additions & 1 deletion scenarios/uplc-turbo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ <h1 id="title">UPLC benchmarks</h1>
<div class="footer-line">Want to contribute? The project is <a href="https://github.com/pragma-org/node-diversity-conformance/tree/scenarios/uplc-turbo" target="_blank" rel="noopener">Open Source <svg class="gh-link" fill="currentColor" width="16" height="16" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"/></svg></a></div>
</footer>
</div>
<script src="../../js/common.js?v=3"></script>
<script src="../../js/percent.js"></script>
<script src="../../js/common.js?v=4"></script>
<script src="scenario.js?v=13"></script>
</body>
</html>
20 changes: 3 additions & 17 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ def load_builders(scenarios):


def build_node_catalog(nodes, scenarios, builders, scenario_entries, scenario_contexts, built_at):
denominators = {}
for scenario in scenarios:
scenario_id = scenario["id"]
builder = builders[scenario_id]
denominators[scenario_id] = max(
(
builder.score(entry["report"], scenario_contexts[scenario_id], entry["id"])[1]
for entry in scenario_entries[scenario_id]
if entry["report"]
),
default=0,
)

cards = []
for node in nodes:
scenario_scores = []
Expand All @@ -56,13 +43,12 @@ def build_node_catalog(nodes, scenarios, builders, scenario_entries, scenario_co
entry = next(item for item in scenario_entries[scenario_id] if item["id"] == node["id"])
report = entry["report"]
passed, total = builder.score(report, scenario_contexts[scenario_id], node["id"])
denominator = denominators[scenario_id]
ratio = passed / denominator if denominator else 0
ratio = passed / total if total else 0
weighted_ratio += ratio / len(scenarios)
scenario_scores.append({
"id": scenario_id,
"title": scenario["title"],
"percentage": round(ratio * 100, 2) if report else None,
"ratio": ratio if report else None,
"passed": passed,
"total": total,
"configured": report is not None,
Expand All @@ -77,7 +63,7 @@ def build_node_catalog(nodes, scenarios, builders, scenario_entries, scenario_co
"color": node.get("color"),
"logo": node["logo_path"],
"description": node["description_html"],
"conformance": {"percentage": round(weighted_ratio * 100, 2)},
"conformance": {"ratio": weighted_ratio},
"scenario_scores": scenario_scores,
"built_at": built_at,
"_ratio": weighted_ratio,
Expand Down
1 change: 1 addition & 0 deletions shared/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ <h1>Node <span class="it">diversity</span></h1>
<div class="footer-line">Want to contribute? The project is <a href="https://github.com/pragma-org/node-diversity-conformance" target="_blank" rel="noopener">Open Source <svg class="gh-link" fill="currentColor" width="16" height="16" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"/></svg></a></div>
</footer>
</div>
<script src="js/percent.js"></script>
<script src="js/home.js"></script>
</body>
</html>
7 changes: 0 additions & 7 deletions shared/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ function nodeLogo(node) {
return node.logo ? `<img class="node-logo-small" src="../../${esc(node.logo)}" alt="">` : nodeDot(node);
}

// A percentage without the sign. Only a perfect score reads 100, and a score is never rounded up to it.
function pctValue(value) {
if (value === null || value === undefined) return '—';
if (value === 1) return '100';
return Math.min(Math.floor(Number(value) * 10000) / 100, 99.99).toFixed(2);
}

function groupLabel(value) {
return String(value).split('/').map((part) => part.replaceAll('_', ' ')).join(' / ');
}
Expand Down
6 changes: 3 additions & 3 deletions shared/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ function renderNodes(nodes) {
const pill = scenario.outdated
? '<span class="outdated-pill" title="At least one report was made with an older version of the dataset">Outdated</span>'
: '';
return `<div class="key-value"><span>${esc(scenario.title)}</span><span class="score-with-pill">${pill}<strong>${scenario.percentage === null ? '-' : `${scenario.percentage}%`}</strong></span></div>`;
return `<div class="key-value"><span>${esc(scenario.title)}</span><span class="score-with-pill">${pill}<strong>${scenario.ratio === null ? '-' : `${pctValue(scenario.ratio)}%`}</strong></span></div>`;
}).join('');
return `<article class="panel node-card">
<img class="node-logo" src="${esc(node.logo)}" alt="${esc(node.name)} logo">
<div class="node-card-body">
<div class="node-card-heading">
<div><h2 style="color:${esc(node.color)}">${esc(node.name)}</h2><div class="container meta-text node-meta m-top-sm">${esc(node.language)}${links}</div></div>
<div class="node-score" style="--node-color:${esc(node.color)}">
<strong>${esc(score.percentage)}<small>%</small></strong>
<span class="node-score-bar" aria-hidden="true"><i style="width:${Math.min(Number(score.percentage) || 0, 100)}%"></i></span>
<strong>${pctValue(score.ratio)}<small>%</small></strong>
<span class="node-score-bar" aria-hidden="true"><i style="width:${Math.min(Number(pctValue(score.ratio)) || 0, 100)}%"></i></span>
</div>
</div>
<div class="prose m-top-sm node-description">${node.description || ''}</div>
Expand Down
8 changes: 8 additions & 0 deletions shared/js/percent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

// A percentage without the sign. Only a perfect score reads 100, and a score is never rounded up to it.
function pctValue(ratio) {
if (ratio === null || ratio === undefined) return '—';
if (ratio === 1) return '100';
return Math.min(Math.floor(Number(ratio) * 10000) / 100, 99.99).toFixed(2);
}
Loading