Changeset 2045


Ignore:
Timestamp:
Sep 29, 2011, 5:31:36 PM (9 years ago)
Author:
robert@…
Message:

Solved issue with startTime = 0s being shown as null and module values that are shown as categorical data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/visualization/VisualizeController.groovy

    r2044 r2045  
    3535         */
    3636        def index = {
     37                println determineCategoryFromData( [ 0, 10, 20, null ] )
     38                println determineCategoryFromData( [ null ] )
     39                println determineCategoryFromData( [ 0, 10, 20, null ] )
     40                println determineCategoryFromData( [ 0, 10, 20, null ] )
     41               
    3742                [ studies: Study.giveReadableStudies( authenticationService.getLoggedInUser() )]
    3843        }
     
    402407                                        def value = closure( sample, parsedField.name );
    403408                                       
    404                                         if( value ) {
     409                                        if( value != null ) {
    405410                                                data << value;
    406411                                        } else {
     
    10841089        results.unique()
    10851090
    1086         if(results.size() != 1){
     1091        if(results.size() > 1) {
    10871092            // If we cannot figure out what kind of a datatype a piece of data is, we treat it as categorical data
    10881093            results[0] = CATEGORICALDATA
    1089         }
     1094        } else if( results.size() == 0 ) {
     1095                        // If the list is empty, return the numerical type. If it is the only value, if will
     1096                        // be discarded later on. If there are more entries (e.g part of a collection)
     1097                        // the values will be regarded as numerical, if the other values are numerical 
     1098                        results[ 0 ] = NUMERICALDATA
     1099        }
    10901100
    10911101        return results[0]
Note: See TracChangeset for help on using the changeset viewer.