Skip to content

Commit 357cf6c

Browse files
committed
include data for tested games only
1 parent 65834bb commit 357cf6c

1 file changed

Lines changed: 58 additions & 16 deletions

File tree

compatibility.html

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@
8686
<h1>PS2 Compatibility Details</h1>
8787
<p id="last-updated">Loading...</p>
8888

89-
<h2>Overall Compatibility Progress</h2>
89+
<h2>Overall Compatibility</h2>
9090
<div id="progress-bar" class="progress-bar"></div>
91+
<ul id="percentages"></ul>
92+
93+
<h2>Tested Compatibility</h2>
94+
<div id="progress-bar-tested" class="progress-bar"></div>
95+
<ul id="percentages-tested"></ul>
9196

9297
<h2>Stacked Breakdown</h2>
9398
<canvas id="stackedChart"></canvas>
@@ -117,34 +122,69 @@ <h2>Breakdown</h2>
117122
"Untested": "rgb(187, 187, 187)"
118123
};
119124

120-
// progress bar
121-
const bar = document.getElementById("progress-bar");
122-
bar.innerHTML = "";
123-
124-
// merge PS2 Classic + Playable
125+
// -------- progress bar (all games) --------
125126
const mergedStats = {
126-
"Fully Compatible": stats["PS2 Classic"] + stats["Playable"],
127+
"Perfect": stats["PS2 Classic"] + stats["Playable"],
127128
"Minor Issues": stats["Minor Issues"],
128129
"Major Issues": stats["Major Issues"],
129130
"Unplayable": stats["Unplayable"],
130131
"Untested": stats["Untested"]
131132
};
132133

133134
const mergedColors = {
134-
"Fully Compatible": "rgb(153, 221, 153)", // green (Classic + Playable)
135+
"Perfect": "rgb(153, 221, 153)", // green
135136
"Minor Issues": "rgb(238, 238, 136)",
136137
"Major Issues": "rgb(238, 153, 51)",
137138
"Unplayable": "rgb(238, 68, 68)",
138139
"Untested": "rgb(187, 187, 187)"
139140
};
140141

142+
function renderProgressBar(containerId, stats, total) {
143+
const bar = document.getElementById(containerId);
144+
bar.innerHTML = "";
145+
for (const [key, value] of Object.entries(stats)) {
146+
const percent = (value / total) * 100;
147+
const segment = document.createElement("div");
148+
segment.className = "progress-segment";
149+
segment.style.backgroundColor = mergedColors[key];
150+
segment.style.width = percent + "%";
151+
bar.appendChild(segment);
152+
}
153+
}
154+
155+
// progress bar including untested
156+
renderProgressBar("progress-bar", mergedStats, total);
157+
158+
// bullet list including untested
159+
const list = document.getElementById("percentages");
160+
list.innerHTML = "";
141161
for (const [key, value] of Object.entries(mergedStats)) {
142-
const percent = (value / total) * 100;
143-
const segment = document.createElement("div");
144-
segment.className = "progress-segment";
145-
segment.style.backgroundColor = mergedColors[key];
146-
segment.style.width = percent + "%";
147-
bar.appendChild(segment);
162+
const percent = ((value / total) * 100).toFixed(1);
163+
const li = document.createElement("li");
164+
li.textContent = `${key}: ${percent}%`;
165+
list.appendChild(li);
166+
}
167+
168+
// tested only
169+
const testedTotal = total - mergedStats["Untested"];
170+
const testedStats = {
171+
"Perfect": mergedStats["Perfect"],
172+
"Minor Issues": mergedStats["Minor Issues"],
173+
"Major Issues": mergedStats["Major Issues"],
174+
"Unplayable": mergedStats["Unplayable"]
175+
};
176+
177+
// second bar for tested-only
178+
renderProgressBar("progress-bar-tested", testedStats, testedTotal);
179+
180+
// Add tested-only text summary
181+
const testedList = document.getElementById("percentages-tested");
182+
testedList.innerHTML = "";
183+
for (const [key, value] of Object.entries(testedStats)) {
184+
const percent = ((value / testedTotal) * 100).toFixed(1);
185+
const li = document.createElement("li");
186+
li.textContent = `${key}: ${percent}% (of tested games)`;
187+
testedList.appendChild(li);
148188
}
149189

150190
// stacked bar chart
@@ -183,10 +223,12 @@ <h2>Breakdown</h2>
183223
// totals
184224
const fullyCompatible = stats["PS2 Classic"] + stats["Playable"];
185225
const fullyPercent = ((fullyCompatible / total) * 100).toFixed(1);
226+
const testedPercent = ((fullyCompatible / (total - stats["Untested"])) * 100).toFixed(1);
186227
document.getElementById("totals").innerHTML =
187-
`<strong>Fully Compatible (PS2 Classic + Playable):</strong> ${fullyPercent}% (${fullyCompatible} games out of ${total})`;
228+
`<strong>Fully Compatible (PS2 Classic + Playable):</strong> ${fullyPercent}% (${fullyCompatible} games out of ${total})<br>
229+
<strong>Tested Compatibility:</strong> ${testedPercent}% of tested games are fully compatible`;
188230
}
189231
loadData();
190232
</script>
191233
</body>
192-
</html>
234+
</html>

0 commit comments

Comments
 (0)