Changeset 173


Ignore:
Timestamp:
12/02/11 15:54:30 (13 years ago)
Author:
jkraaijeveld
Message:

Bugfix in toSPSS(): entry elements were printed in an incorrect order. They now properly match the question stated in the header.

Location:
Dev/trunk/classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/Session.php

    r171 r173  
    6464                        }
    6565                }
     66                //Return if there are no surveys.
     67                if(count($headers) < 2)
     68                        return;
    6669               
    6770                $answers = $this->getAnswers($headers);
     
    7881                {
    7982                        $entryString = "";
    80                         foreach(array_keys($entry) as $i)
     83                        //PHP doesn't automatically sort the indices so I have to do it myself
     84                        $keys = array_keys($entry);
     85                        asort($keys);
     86                        //Entry elements can now be printed in order to match the headers
     87                        foreach($keys as $i)
    8188                        {
    8289                                $entryString = $entryString . $entry[$i] . "\t";       
     
    103110                {
    104111                        $entryIndex;
    105                         if(in_array($answerset->respondent->uid, $respondentsUsed))
     112                        if(in_array($answerset->respondent->name, $respondentsUsed))
    106113                        {
    107                                 $entryIndex = array_search($answerset->respondent->uid, $respondentsUsed);
     114                                $entryIndex = array_search($answerset->respondent->name, $respondentsUsed);
    108115                                $entry = $answers[$entryIndex];
    109116                        }
     
    111118                        {
    112119                                $entry = array();
    113                                 $entry[0] = $answerset->respondent->uid;
     120                                $entry[0] = $answerset->respondent->name;
    114121                                $entryIndex = count($respondentsUsed);
    115                                 $respondentsUsed[] = $answerset->respondent->uid;
     122                                $respondentsUsed[] = $answerset->respondent->name;
    116123                        }
    117124                        foreach ($answerset->answers as $answer)
  • Dev/trunk/classes/SessionConnector.php

    r171 r173  
    4848                                ' . $this->createArguments($arguments) . '
    4949                        }';
    50                 echo $querystring;
    5150                //Query the model
    5251                $results = $this->model->sparqlQuery($querystring);
Note: See TracChangeset for help on using the changeset viewer.