[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/www/survey/admin show_results_aggregate.php, 1.
From: |
tom |
Subject: |
[Gforge-commits] gforge/www/survey/admin show_results_aggregate.php, 1.6, 1.7 |
Date: |
Wed, 04 Feb 2004 11:10:05 -0600 |
Update of /cvsroot/gforge/gforge/www/survey/admin
In directory db.perdue.net:/tmp/cvs-serv14203/www/survey/admin
Modified Files:
show_results_aggregate.php
Log Message:
Fixed bug [ #597 ] Viewing aggregate survey result contains some errors
Index: show_results_aggregate.php
===================================================================
RCS file: /cvsroot/gforge/gforge/www/survey/admin/show_results_aggregate.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- show_results_aggregate.php 24 Apr 2003 14:26:41 -0000 1.6
+++ show_results_aggregate.php 4 Feb 2004 17:10:02 -0000 1.7
@@ -90,12 +90,7 @@
}
- if ($question_type == "1") {
-
- /*
- This is a r�dio-button question. Values 1-5.
- */
-
+ if ($question_type == "1") { // This is a radio-button question. Values
1-5.
// Show the 1-5 markers only if this is the first in a series
if ($question_type != $last_question_type) {
@@ -104,9 +99,7 @@
}
- /*
- Select the number of responses to this question
- */
+ // Select the number of responses to this question
$sql="SELECT count(*) AS count FROM survey_responses WHERE
survey_id='$survey_id' AND question_id='$quest_array[$i]' AND response IN
('1','2','3','4','5') AND group_id='$group_id'";
$result2=db_query($sql);
if (!$result2 || db_numrows($result2) < 1) {
@@ -116,9 +109,8 @@
$response_count = db_result($result2, 0, 'count');
echo "<strong>" . $response_count . "</strong>"
.$Language->getText('survey_show_results_aggregate','responses')."<br />";
}
- /*
- average
- */
+
+ // average
if ($response_count > 0){
$sql="SELECT avg(response::int) AS avg FROM
survey_responses WHERE survey_id='$survey_id' AND
question_id='$quest_array[$i]' AND group_id='$group_id' AND response IN
('1','2','3','4','5')";
$result2=db_query($sql);
@@ -139,31 +131,17 @@
GraphResult($result2,stripslashes(db_result($result, 0, "question")));
}
}// end if (responses to survey question present)
- } else if ($question_type == "2") {
- /*
- This is a text-area question.
- */
-
+ } else if ($question_type == "2") { // This is a text-area question.
echo db_result($result, 0, "question")."<br />\n";
-
echo "<a
href=\"show_results_comments.php?survey_id=$survey_id&question_id=$quest_array[$i]&group_id=$group_id\">".$Language->getText('survey_show_results_aggregate','view_comments')."</a>";
- } else if ($question_type == "3") {
- /*
- This is a Yes/No question.
- */
-
- /*
- Show the Yes/No only if this is the first in a series
- */
-
+ } else if ($question_type == "3") { // This is a Yes/No question.
+ // Show the Yes/No only if this is the first in a series
if ($question_type != $last_question_type) {
echo
"<strong>".$Language->getText('survey_show_results_aggregate','yes_no')."</strong><br
/>\n";
}
- /*
- Select the count and average of responses to this
question
- */
+ // Select the count and average of responses to this question
$sql="SELECT count(*) AS count FROM survey_responses WHERE
survey_id='$survey_id' AND question_id='$quest_array[$i]' AND
group_id='$group_id' AND response IN (1,5)";
$result2=db_query($sql);
@@ -171,12 +149,11 @@
echo
$Language->getText('survey_show_results_aggregate','error');
echo db_error();
} else {
- echo "<strong>".db_result($result2, 0,
0)."</strong>".$Language->getText('survey_show_results_aggregate','responses')."<br
/>";
+ echo "<strong>".db_result($result2, 0, 0)."</strong>
".$Language->getText('survey_show_results_aggregate','responses')."<br />";
}
- /*
- average
- */
- $sql="SELECT avg(response::int) AS avg FROM survey_responses
WHERE survey_id='$survey_id' AND question_id='$quest_array[$i]' AND
group_id='$group_id'";
+
+ // average
+ $sql="SELECT avg(response::int) AS avg FROM survey_responses
WHERE survey_id='$survey_id' AND question_id='$quest_array[$i]' AND
group_id='$group_id' and response != ''";
$result2=db_query($sql);
if (!$result2 || db_numrows($result2) < 1) {
@@ -186,9 +163,7 @@
echo "<strong>".number_format(db_result($result2, 0,
0),2)."</strong>".$Language->getText('survey_show_results_aggregate','average');
}
- /*
- Get the YES responses
- */
+ // Get the YES responses
$sql="SELECT count(*) AS count FROM survey_responses WHERE
survey_id='$survey_id' AND question_id='$quest_array[$i]' AND
group_id='$group_id' AND response='1'";
$result2=db_query($sql);
@@ -201,9 +176,7 @@
$value_array[0]=db_result($result2, 0, "count");
}
- /*
- Get the NO responses
- */
+ // Get the NO responses
$sql="SELECT count(*) AS count FROM survey_responses WHERE
survey_id='$survey_id' AND question_id='$quest_array[$i]' AND
group_id='$group_id' AND response='5'";
$result2=db_query($sql);
@@ -220,19 +193,10 @@
} else if ($question_type == "4") {
- /*
- This is a comment only.
- */
-
echo " <p><strong>".db_result($result, 0,
"question")."</strong></p>\n";
echo "<input type=\"hidden\" name=\"_".$quest_array[$i]."\"
value=\"-666\" />";
- } else if ($question_type == "5") {
-
- /*
- This is a text-field question.
- */
-
+ } else if ($question_type == "5") { // This is a text-field question.
echo db_result($result, 0, "question")."<br />\n";
echo "<a
href=\"show_results_comments.php?survey_id=$survey_id&question_id=$quest_array[$i]&group_id=$group_id\">".$Language->getText('survey_show_results_aggregate','view_comments')."</a>";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/www/survey/admin show_results_aggregate.php, 1.6, 1.7,
tom <=