From eb2873725c8eff479e111d18f41618b783477569 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Fri, 8 Jan 2016 12:29:01 -0500 Subject: [PATCH] Fixed entries with no minimum time and where start line and finish line are different. --- entry.js | 1 + lib/entry.php | 10 ++++++---- propel/build/classes/buckyball/Course.php | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 propel/build/classes/buckyball/Course.php diff --git a/entry.js b/entry.js index 6525624..4e5f7e2 100644 --- a/entry.js +++ b/entry.js @@ -242,6 +242,7 @@ function calculate_penalty(allotted_time, bonus_time, raced_time) { /* Calculate total time. */ function calculate_total(allotted_time, bonus_time, penalty_time, raced_time) { + if (! allotted_time) return raced_time; if (raced_time > allotted_time) return allotted_time + bonus_time + penalty_time; /* Cut short. */ return allotted_time + bonus_time; diff --git a/lib/entry.php b/lib/entry.php index 7d212b4..2da7077 100644 --- a/lib/entry.php +++ b/lib/entry.php @@ -107,8 +107,8 @@ $system_ids[] = $system_id; $system_order[] = $system_id; $flags = 0; - if ($leg->getStartLine()) $flags |= 2; - else if (! $leg->getFinishLine()) $flags |= 1; + if ($leg->getStartLine()) $flags |= Course::StartFlag(); + if ($leg->getFinishLine()) $flags |= Course::FinishFlag(); $legs[$station_name] = array($flags, $station->getId(), $system_id); } arsort($legs); @@ -168,9 +168,11 @@ $n = 0; foreach ($legs as $station => $attributes) { list($flags, $id, $system_id) = $attributes; + /* Skip finish line. */ + if ($flags & Course::FinishFlag() && ! ($flags & Course::StartFlag())) continue; $n++; $label = $station; - $class = ($flags & 2) ? ' class="start_line"' : ''; + $class = ($flags & Course::StartFlag()) ? ' class="start_line"' : ''; echo "\n"; echo "

$station

\n"; echo "

\n"; @@ -178,7 +180,7 @@ } foreach ($legs as $station => $attributes) { list($flags, $id, $system_id) = $attributes; - if ($flags & 1) continue; + if (! ($flags & Course::FinishFlag())) continue; $class = ' class="finish_line"'; echo "\n"; echo "

$station

\n"; diff --git a/propel/build/classes/buckyball/Course.php b/propel/build/classes/buckyball/Course.php new file mode 100644 index 0000000..a2b196e --- /dev/null +++ b/propel/build/classes/buckyball/Course.php @@ -0,0 +1,21 @@ +