Changeset 2214

Show
Ignore:
Timestamp:
05-04-12 19:58:16 (2 years ago)
Author:
work@…
Message:

removed 'count' from getMeasurementDataForAssay as the JSON parser sometimes seems to break with a strange error 'misplaced key' when more than just the 'measurements' is returned. Weird, but it's not really necessary altogether, so better to get it out...

Location:
trunk/grails-app
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/api/ApiController.groovy

    r2213 r2214  
    275275            // define sample measurement data matrix 
    276276            def matrix = [:] 
    277             def measurementData = apiService.getMeasurementData(assay, user) 
     277            def measurementData = apiService.getMeasurementData(assay, user).toArray() 
    278278            //def measurementMetaData = apiService.getMeasurementData(assay, user) 
    279279 
    280280            // iterate through measurementData and build data matrix 
    281 //            try { 
     281            try { 
    282282                measurementData.each { data -> 
    283283                    if (!matrix.containsKey(data.sampleToken)) matrix[data.sampleToken] = [:] 
     
    286286 
    287287                // define result 
    288                 def result = [ 
    289                         'count'         : matrix.size(), 
     288                def result = [:] 
     289                result = [ 
    290290                        'measurements'  : matrix 
    291291                ] 
     
    300300                    render result as JSON 
    301301                } 
    302 //            } catch (Exception e) { 
    303 //                println "getMeasurementDataForAssay exception: ${e.getMessage()}" 
    304 //                response.sendError(500, "module '${assay.module}' does not properly implement getMeasurementData REST specification (${e.getMessage()})") 
    305 //            } 
     302            } catch (Exception e) { 
     303                println "getMeasurementDataForAssay exception: ${e.getMessage()}" 
     304                response.sendError(500, "module '${assay.module}' does not properly implement getMeasurementData REST specification (${e.getMessage()})") 
     305            } 
    306306        }) 
    307307    } 
  • trunk/grails-app/views/api/index.gsp

    r2202 r2214  
    533533<blockquote> 
    534534    { 
    535     "count": 
    536     14, 
    537535    "measurements": 
    538536    {