Skip to content
Permalink
Browse files

add three new Top 10 Committers graphs:

* doc
* ports
* src

fixes #120
  • Loading branch information...
dlangille committed Jul 13, 2019
1 parent bdc8c38 commit f7f18c656fb0478fc442cb9cc0cee834c633140c
Showing with 139 additions and 2 deletions.
  1. +2 −0 include/constants.php
  2. +1 −1 include/freshports.php
  3. +57 −0 www/generate_content.php
  4. +78 −0 www/graphs.js
  5. +1 −1 www/graphs2.php
@@ -125,3 +125,5 @@
define('MAINTENANCE_PAGE', 'now-in-maintenance-mode.php');
define('MAINTENANCE_MODE_RERESH_TIME_SECONDS', 180);
define('ISSUES', 'https://github.com/FreshPorts/freshports/issues');
@@ -1822,7 +1822,7 @@ function freshports_SideBar() {
<td valign="top">
<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/about.php", "What is FreshPorts?", "A bit of background on FreshPorts" ) . '</FONT><br>
<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/authors.php", "About the authors", "Who wrote this stuff?" ) . '</FONT><br>
<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "https://github.com/FreshPorts/freshports/issues", "Issues", "Report a website problem" ) . '</FONT><br>
<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], ISSUES , "Issues", "Report a website problem" ) . '</FONT><br>
<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/faq.php", "FAQ", "Frequently Asked Questions" ) . '</FONT><br>
<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/how-big-is-it.php", "How big is it?", "How many pages are in this website?" ) . '</FONT><br>
<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/release-2004-10.php", "The latest upgrade!", "Details on the latest website upgrade") . '</FONT><br>
@@ -38,6 +38,63 @@
}
echo " ]";
break;
case ('top10Committers_doc()'):
$result = pg_query(" SELECT CL.committer, count(*) AS count
FROM commit_log CL, repo R
WHERE CL.repo_id = R.id
AND R.name = 'doc'
GROUP BY CL.committer
ORDER BY count(*) DESC
LIMIT 10") or die("Query error. (1)");
echo "[ ";
$i = 0;
while ($row = pg_fetch_row($result)) {
echo "{ ";
echo "\"label\": \"$row[0]\", ";
echo "\"data\": [[$i, $row[1]]] ";
echo "}, ";
$i++;
}
echo " ]";
break;
case ('top10Committers_ports()'):
$result = pg_query(" SELECT CL.committer, count(*) AS count
FROM commit_log CL, repo R
WHERE CL.repo_id = R.id
AND R.name = 'ports'
GROUP BY CL.committer
ORDER BY count(*) DESC
LIMIT 10") or die("Query error. (1)");
echo "[ ";
$i = 0;
while ($row = pg_fetch_row($result)) {
echo "{ ";
echo "\"label\": \"$row[0]\", ";
echo "\"data\": [[$i, $row[1]]] ";
echo "}, ";
$i++;
}
echo " ]";
break;
case ('top10Committers_src()'):
$result = pg_query(" SELECT CL.committer, count(*) AS count
FROM commit_log CL, repo R
WHERE CL.repo_id = R.id
AND R.name = 'src'
GROUP BY CL.committer
ORDER BY count(*) DESC
LIMIT 10") or die("Query error. (1)");
echo "[ ";
$i = 0;
while ($row = pg_fetch_row($result)) {
echo "{ ";
echo "\"label\": \"$row[0]\", ";
echo "\"data\": [[$i, $row[1]]] ";
echo "}, ";
$i++;
}
echo " ]";
break;
case ('commitsOverTime()'):
$result = pg_query("select date_trunc('day', commit_date) as date, count(commit_date) from commit_log group by date") or die("Query error. (2)");
echo "[ ";
@@ -44,6 +44,84 @@ function top10committers() {
});
}

function top10committers_src() {
$("#title").html("<h3>Top 10 Committers - src</h3>");
$("#holder").width(800);
$("#holder").height(500);
$("#overview").hide();
$("#list").hide();
$.getJSON("generate_content.php?ds=top10Committers_src()", function(d1) {
$.plot($("#holder"), d1,
{
bars: { show: true },
legend: { show: false },
xaxis: {
ticks: function(axis) {
var ret = [];
var i = 0;
for (i = 0; i < d1.length; i++) {
ret.push([i + .5, d1[i].label]);
}
return ret;
}
}
}
);
});
}

function top10committers_doc() {
$("#title").html("<h3>Top 10 Committers - doc</h3>");
$("#holder").width(800);
$("#holder").height(500);
$("#overview").hide();
$("#list").hide();
$.getJSON("generate_content.php?ds=top10Committers_doc()", function(d1) {
$.plot($("#holder"), d1,
{
bars: { show: true },
legend: { show: false },
xaxis: {
ticks: function(axis) {
var ret = [];
var i = 0;
for (i = 0; i < d1.length; i++) {
ret.push([i + .5, d1[i].label]);
}
return ret;
}
}
}
);
});
}

function top10committers_ports() {
$("#title").html("<h3>Top 10 Committers - ports</h3>");
$("#holder").width(800);
$("#holder").height(500);
$("#overview").hide();
$("#list").hide();
$.getJSON("generate_content.php?ds=top10Committers_ports()", function(d1) {
$.plot($("#holder"), d1,
{
bars: { show: true },
legend: { show: false },
xaxis: {
ticks: function(axis) {
var ret = [];
var i = 0;
for (i = 0; i < d1.length; i++) {
ret.push([i + .5, d1[i].label]);
}
return ret;
}
}
}
);
});
}

/* Taken practically verbatim from Flot examples. */
function commitsOverTime() {
$("#title").html("<h3>Commits Over Time</h3>");
@@ -33,7 +33,7 @@
All of these graphs require javascript. Please select the graph you would like to view from the dropdown.
</P>
<P>
If you have suggestions for graphs, please submit them via the forum.
If you have suggestions for graphs, please submit them via the <a href="<?php echo ISSUES; ?>">issues link</a>.
</P>

<center>

0 comments on commit f7f18c6

Please sign in to comment.
You can’t perform that action at this time.