function percentDone($package, $next = false) { if (!$next) { list($next, ) = Roadmap_Info::nextRelease($package); } $sql = ' SELECT bugdb.status, COUNT(bugdb.id) FROM bugdb_roadmap_link b_r_l, bugdb_roadmap b_r, bugdb WHERE b_r.roadmap_version = ? AND b_r.package = ? AND b_r_l.roadmap_id = b_r.id AND bugdb.id = b_r_l.id GROUP BY bugdb.status'; $count = $GLOBALS['dbh']->getAssoc($sql, false, array($next, $package)); $total = $closed = 0; $s = array('Closed', 'Duplicate', 'Bogus', "Won't Fix"); foreach ($count as $status => $amount) { if (in_array($status, $s)) { $closed = $amount; } $total += $amount; } if (!$total) { return 0; } return round(100 * $closed / $total); }
echo $rel_ver . '.tgz">' . $rel_ver . '</a>'; echo ' (stable)'; echo ' was released on '; echo format_date(strtotime($rel_arr['releasedate']), 'Y-m-d'); echo ' (<a href="/package/' . htmlspecialchars($name); echo '/download/' . $rel_ver . '">Changelog</a>)'; break; } } } } else { echo 'No releases have been made yet.'; } if (empty($pkg['bug_link']) && Roadmap_Info::roadmapExists($name)) { echo '<br /><a href="/bugs/roadmap.php?package=' . urlencode($name) . '">Development Roadmap</a>'; $nextrelease = Roadmap_Info::nextRelease($name); if ($nextrelease) { $x = ceil((strtotime($nextrelease[1]) - time()) / 60 / 60 / 24); echo ' (next release: <strong><a href="/bugs/roadmap.php?package=' . urlencode($name) . '&roadmapdetail=' . $nextrelease[0] . '#a' . $nextrelease[0] . '">' . $nextrelease[0] . '</a></strong> in '; echo $x . ' day'; if ($x != 1) { echo 's'; } if ($x < 0) { echo '!!'; } echo ', ' . Roadmap_Info::percentDone($name) . '% complete)'; } } echo '</td>' . "\n"; echo '<td>' . "\n";