Skip to content

Commit

Permalink
remove coin toss / invalid drives
Browse files Browse the repository at this point in the history
  • Loading branch information
akeaswaran committed Sep 1, 2024
1 parent e8a9534 commit ba38f3b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frontend/views/pages/cfb/game.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const homeComp = gameData.gameInfo.competitors[0];
const awayComp = gameData.gameInfo.competitors[1];
const homeTeam = homeComp.team;
const awayTeam = awayComp.team;
function unique(a) {
return a.sort().filter(function(item, pos, ary) {
return !pos || item != ary[pos - 1];
});
}
function getNumberWithOrdinal(n) {
var s = ["th", "st", "nd", "rd"];
v = n % 100;
Expand Down Expand Up @@ -1263,9 +1268,15 @@ function buildPlayTable(plays, prefix, expandable, errorMsg, showGuide, expandin
</main>
<main class="col-lg-6 ms-sm-auto px-md-4">
<%
var curDrive = gameData.drives.current
var currentDrives = (curDrive != null) ? [curDrive] : [];
var gameDrives = [...gameData.drives.previous, ...currentDrives]
if (gameDrives.length > 0) {
var validDriveIds = unique(gameData.plays.map(p => p['drive.id']))
gameDrives = gameDrives.filter(d => validDriveIds.includes(d.id))
}
var subTitle = ""
if (gameData.gameInfo.status.type.completed != true) {
subTitle = '<p class="text-small">Most recent drives first.</p>';
Expand Down

0 comments on commit ba38f3b

Please sign in to comment.