Skip to content

Commit 002baeb

Browse files
RivianTrackrclaude
andcommitted
Hide proprietary efficiency score from frontend
Discontinue surfacing the calculated efficiency score (A–F grade + 0–100 value) to users, while keeping all stored data and admin tooling intact so the change is fully reversible. Frontend display removed: - Tire card efficiency badge (cards.js); the Roamer real-world mi/kWh pill, which shared the same styling, is preserved and un-nested so it renders on its own. - Compare page efficiency badge in tire headers and the Performance section, plus its now-dead CSS and best-value highlighting. - "Efficiency Grade" option in the sort dropdown. - Orphaned "Efficiency Score" tooltip. Default sort moved off efficiency to "Real-World Efficiency" so results are no longer ordered by the discontinued score: - Client sort + allow-list (filters.js, validation.js). - Server-side pagination mode (server.js + AJAX handler). - Public REST /tires endpoint. efficiency_score is kept as an accepted sort value for backward compatibility, just not the default. Deliberately untouched: DB columns, calculation engine, admin tire-edit preview / "Recalculate Grades", CSV import/export, and the efficiency calc endpoints. Values still flow through the payload at their existing array positions; the frontend just no longer renders or sorts on them. Build regenerated (all 7 targets); 83/83 JS tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2b22414 commit 002baeb

12 files changed

Lines changed: 70 additions & 173 deletions

File tree

frontend/js/compare.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ const COL = {
6767
roamerEfficiency: 24, roamerTotalKm: 25, roamerVehicleCount: 26, roamerVehicleBreakdown: 27
6868
};
6969

70-
// --- Efficiency badge colors ---
71-
const GRADE_COLORS = {
72-
A: "#34c759", B: "#7dc734", C: "#facc15", D: "#f97316", F: "#b91c1c"
73-
};
74-
7570
// --- Determine "best" values for highlighting ---
7671
function findBestValues(tires) {
7772
const best = {};
@@ -86,26 +81,12 @@ function findBestValues(tires) {
8681
const warranties = tires.map(t => parseInt(t[COL.warranty])).filter(n => !isNaN(n) && n > 0);
8782
if (warranties.length > 1) best.warranty = Math.max(...warranties);
8883

89-
const scores = tires.map(t => parseInt(t[COL.effScore])).filter(n => !isNaN(n) && n > 0);
90-
if (scores.length > 1) best.effScore = Math.max(...scores);
91-
9284
const roamerVals = tires.map(t => parseFloat(t[COL.roamerEfficiency])).filter(n => !isNaN(n) && n > 0);
9385
if (roamerVals.length > 1) best.roamerEfficiency = Math.max(...roamerVals);
9486

9587
return best;
9688
}
9789

98-
// --- Build efficiency badge HTML ---
99-
function effBadge(score, grade) {
100-
const s = escapeHTML(score || "-");
101-
const g = escapeHTML((grade || "-").toUpperCase());
102-
const color = GRADE_COLORS[g] || "#a19e97";
103-
return `<span class="cmp-eff-badge">
104-
<span class="cmp-eff-grade" style="background:${color}">${g}</span>
105-
<span class="cmp-eff-score">${s}/100</span>
106-
</span>`;
107-
}
108-
10990
// --- Build tag HTML ---
11091
function renderTags(tagStr) {
11192
if (!tagStr || tagStr === "-") return "-";
@@ -217,10 +198,6 @@ function renderComparison(rows, indexes) {
217198
<span class="cmp-tire-meta-label">Weight</span>
218199
<span class="cmp-tire-meta-value">${fmtWeight(t[COL.weight])}</span>
219200
</div>
220-
<div class="cmp-tire-meta-item">
221-
<span class="cmp-tire-meta-label">Efficiency</span>
222-
<span class="cmp-tire-meta-value">${effBadge(t[COL.effScore], t[COL.effGrade])}</span>
223-
</div>
224201
</div>
225202
</div>
226203
</div>`;
@@ -239,7 +216,6 @@ function renderComparison(rows, indexes) {
239216
], tires, best, n);
240217

241218
html += specSection('gauge-high', 'Performance', [
242-
['Efficiency', t => effBadge(t[COL.effScore], t[COL.effGrade]), 'effScore'],
243219
['Real-World Efficiency', t => {
244220
const v = parseFloat(t[COL.roamerEfficiency]);
245221
if (!v || v === 0) return '-';

frontend/js/compare.min.js

Lines changed: 7 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)