Skip to content

Commit

Permalink
Removed feature: Ranking slots setting was obsolete in ranking questi…
Browse files Browse the repository at this point in the history
…on type ( it is covered by max slots)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@9083 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Aug 23, 2010
1 parent ea9f0ea commit 244a594
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 92 deletions.
11 changes: 0 additions & 11 deletions admin/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,17 +913,6 @@ function get_max_question_order($gid)
$sortorderid--;
$action='editansweroptions';

// Special treatment for ranking questions
$surveyinfo=getSurveyInfo($surveyid);
if ($questiontype=='R' && $surveyinfo['active']=='N')
{
$query="update ".db_table_name('question_attributes')." set value='$sortorderid' where attribute='ranking_slots' and qid=$qid";
if (!$result = $connect->Execute($query)) // Checked
{
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Failed to update answers","js")." - ".$query." - ".$connect->ErrorMsg()."\")\n //-->\n</script>\n";
}
}

}

elseif ($action == "updatesubquestions" && ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $actsurrows['define_questions']))
Expand Down
10 changes: 1 addition & 9 deletions admin/importsurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -1006,15 +1006,7 @@ function CSVImportSurvey($sFullFilepath)
}
}

// Fix up the slots for ranking questions
$sQuery = "SELECT qid FROM {$dbprefix}questions where sid=$newsid and type='R' and parent_qid=0"; //Get last question added (finds new qid)
$gres = db_execute_assoc($sQuery);
while ($aRow = $gres->FetchRow())
{
$iSlots=$connect->GetOne("select count(code) from {$dbprefix}answers where qid={$aRow['qid']} and language='{$sBaseLanguage}'");
setQuestionAttribute($aRow['qid'],'ranking_slots',$iSlots);
}



//... and for the questions inside the groups
// get all group ids and fix questions inside each group
Expand Down
19 changes: 1 addition & 18 deletions admin/update/upgrade-mssql.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,24 +682,7 @@ function upgrade_tables143()
}
}

// convert Ranking question type

$query="SELECT a.qid, count(a.qid) as answercount FROM {$dbprefix}answers a, {$dbprefix}questions q where a.qid=q.qid and q.type='R' group by a.qid";
$queryresult = db_execute_assoc($query);
if (!$queryresult)
{
return "Database Error";
}
else
{
while ( $row = $queryresult->FetchRow() )
{
modify_database("","INSERT INTO {$dbprefix}question_attributes (qid, attribute, value) VALUES ({$row['qid']},'ranking_slots',".db_quoteall($row['answercount']).")"); echo $modifyoutput; flush();
}
}




$updatequery = "update {$dbprefix}questions set type='!' where type='W'";
modify_database("",$updatequery); echo $modifyoutput; flush();
$updatequery = "update {$dbprefix}questions set type='L' where type='Z'";
Expand Down
18 changes: 1 addition & 17 deletions admin/update/upgrade-mssqlnative.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,23 +682,7 @@ function upgrade_tables143()
}
}

// convert Ranking question type

$query="SELECT a.qid, count(a.qid) as answercount FROM {$dbprefix}answers a, {$dbprefix}questions q where a.qid=q.qid and q.type='R' group by a.qid";
$queryresult = db_execute_assoc($query);
if (!$queryresult)
{
return "Database Error";
}
else
{
while ( $row = $queryresult->FetchRow() )
{
modify_database("","INSERT INTO {$dbprefix}question_attributes (qid, attribute, value) VALUES ({$row['qid']},'ranking_slots',".db_quoteall($row['answercount']).")"); echo $modifyoutput; flush();
}
}




$updatequery = "update {$dbprefix}questions set type='!' where type='W'";
modify_database("",$updatequery); echo $modifyoutput; flush();
Expand Down
18 changes: 1 addition & 17 deletions admin/update/upgrade-mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,23 +698,7 @@ function upgrade_tables143()
}
}

// convert Ranking question type

$query="SELECT a.qid, count(a.qid) as answercount FROM {$dbprefix}answers a, {$dbprefix}questions q where a.qid=q.qid and q.type='R' group by a.qid";
$queryresult = db_execute_assoc($query);
if (!$queryresult)
{
return "Database Error";
}
else
{
while ( $row = $queryresult->FetchRow() )
{
modify_database("","INSERT INTO {$dbprefix}question_attributes (qid, attribute, value) VALUES ({$row['qid']},'ranking_slots',".db_quoteall($row['answercount']).")"); echo $modifyoutput; flush();
}
}




$updatequery = "update {$dbprefix}questions set type='!' where type='W'";
modify_database("",$updatequery); echo $modifyoutput; flush();
Expand Down
17 changes: 1 addition & 16 deletions admin/update/upgrade-postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,22 +435,7 @@ function upgrade_tables143()
}
}

// convert Ranking question type

$query="SELECT a.qid, count(a.qid) as answercount FROM {$dbprefix}answers a, {$dbprefix}questions q where a.qid=q.qid and q.type='R' group by a.qid";
$queryresult = db_execute_assoc($query);
if (!$queryresult)
{
return "Database Error";
}
else
{
while ( $row = $queryresult->FetchRow() )
{
modify_database("","INSERT INTO {$dbprefix}question_attributes (qid, attribute, value) VALUES ({$row['qid']},'ranking_slots',".db_quoteall($row['answercount']).")"); echo $modifyoutput; flush();
}
}




$updatequery = "update {$dbprefix}questions set type='!' where type='W'";
Expand Down
4 changes: 0 additions & 4 deletions qanda.php
Original file line number Diff line number Diff line change
Expand Up @@ -2483,10 +2483,6 @@ function do_ranking($ia)
$max_answers = false;
}
$ansresult = db_execute_assoc($ansquery); //Checked
$anscount = $qidattributes["ranking_slots"];
if(!$max_answers) {
$max_answers=$anscount;
}
$finished=$anscount-$max_answers;
$answer .= "\t<script type='text/javascript'>\n"
. "\t<!--\n"
Expand Down

0 comments on commit 244a594

Please sign in to comment.