$projects = getProjects() ;
global $questions;
$n_projects = count($projects);
global $n_answers;
$n_answers = getNumSurveys();
$avg_data = getAverages();
function printProfile($answer, $opts, $group, $multiple) {
// NOBODY WILL EVER UNDERSTAND MY CODE MWAHAHAHA
for ($i=1; $i <= count($opts); $i++) {
$l = letter($i-1);
?>
|
=$l ?>. =$opts[$i-1]?>
$values = getAnswersGrouped($answer+1, $i+1, "makeRadio", $group, $multiple);
for ($k=1; $k<7; $k++) {
$optval = $values[$k];
if ( $optval != -1 ) { // XXX
?>
|
=$optval["count"]?> (=avg($optval["count"])?>%)
}
}
$optval = $values[0];
?>
|
=$optval["count"]?> (=avg($optval["count"])?>%)
} ?>
|
|
Other
$values = getAnswersGrouped($answer+1, 01, "makeRadio", $group, $multiple);
for ($k=1; $k<7; $k++) {
$optval = $values[$k];
if ( $optval != -1 ) { // XXX
?>
|
=$optval["count"]?> (=avg($optval["count"])?>%)
}
}
}
function printRadioResults($opts, $optnum, $optval) {
foreach ( $results as $result ) {
// this test is a bit wierd, but so are pgsql indexes. the fact
// is that the value for unanswered questions is 0, which means
// that a select will return counts even if the u
if ( $optnum == 0 ) {
$unanswered = $optval;
continue; // we don't want to print other right now
}
if ( $optnum == 1 ) {
$otherval = $optval;
continue; // we don't want to print other right now
}
// postgres answer index starts at 2 (1 is other), thus -2
printOptLine( $opts[$optnum-2], $optval, $optnum-2 );
}
if ( $otherval ) {
printOptLine( "Other", $otherval );
$otherval = 0;
}
if ( $unanswered ) {
printOptLine( "(Left unanswered)", $unanswered );
$unanswered = 0;
}
}
function printCheckResults($index, $opts) {
// there is one extra option, which is position 0, for "other" so we
// need to adjust the total loop and then the index to opts. Yes,
// this is ugly but I don't care enough to fix it. the position is
// used as a mask in getchecktotal, just so you know.
for ( $o = 0; $o < count($opts) + 1; $o++ ) {
$res = getCheckTotal($index, $o);
if ( $o == 0 ) {
$otherval = $res["count"];
continue; // we don't want to print other right now
}
if ( $res["count"] > 0 ) {
printOptLine( $opts[$o-1], $res["count"], $o-1 );
}
}
if ( $otherval > 0 ) {
printOptLine( "Other", $otherval, $o-1 );
$otherval = 0;
}
$unanswered = getCheckUnanswered($index);
if ( $unanswered["count"] > 0 ) {
printOptLine( "(Did not choose any)", $unanswered["count"] );
}
}
?>
|
|
We list here the results obtained in the survey up to now. If you would
like this data in a convenient format, please let me know.
Totals
- Number of registered projects: = $n_projects ?>
- Number of projects that have completed surveys: = $n_answers ?>
(=sprintf("%.1f", $n_answers/$n_projects * 100) ?>%)
Summary of project sourcecode data
- Average size of project tarball: = round($avg_data[avg_size]/1000,2)
?> KBytes
- Average time since last public release: = $avg_data[avg_time] ?> days
- Average number of languages per project: =
round($avg_data[avg_langcount],2) ?> languages
- Average of total LOC per project: =
round($avg_data[avg_sloc]/1000,2) ?> KSLOC
Survey answers
for ( $i = 0; $i < count($questions); $i++ ) {
$num = $questions[$i]["snum"].".".$questions[$i]["qnum"];
if ( $questions[$i]["func"] == "makeChecks" ) {
$multiple=TRUE;
} else {
$multiple=FALSE;
}
printQuestLine($num, $questions[$i]["title"], $multiple);
global $$questions[$i]["items"];
$opts = $$questions[$i]["items"];
printProfile($i, $opts, 5, $multiple);
?>
| |
}
?>
Note: for multiple-choice answers, the totals for the different
percentages may surpass 100%. This is expected, since a single project
can have more than one option selected.
|