Changeset 1633


Ignore:
Timestamp:
Mar 14, 2011, 4:36:39 PM (6 years ago)
Author:
s.h.sikkema@…
Message:

Fixed 'Assay has no value (null)' error in assay exporter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/AssayController.groovy

    r1632 r1633  
    140140    def selectFields = {
    141141        // receives an assay id
    142         def assay = Assay.get(params.assayId)
     142        def assayId = params.assayId
     143
     144        // did the assay id value come across?
     145        if (!assayId) {
     146            flash.errorMessage = "An error occurred: assayId = ${assayId}."
     147            redirect action: 'selectAssay'
     148            return
     149        }
     150
     151        Assay assay = Assay.get(assayId)
     152
     153        // check if assay exists
     154        if (!assay) {
     155
     156            flash.errorMessage = "No assay found with id: ${assayId}"
     157            redirect action: 'selectAssay'
     158            return
     159        }
    143160
    144161        // obtain fields for each category
     
    157174        flash.fieldMap = fieldMap
    158175        flash.measurementTokens = measurementTokens
    159         flash.assayId = params.assayId
     176        flash.assayId = assayId
     177
     178        // remove me
     179        println flash
    160180
    161181        [fieldMap: fieldMap, measurementTokens: measurementTokens.name]
     
    172192        def assayId = flash.assayId
    173193
    174         println assayId
     194        // remove me
     195        println flash
    175196
    176197        // did the assay id value come across?
     
    189210            redirect action: 'selectAssay'
    190211            return
    191 
    192212        }
    193213
Note: See TracChangeset for help on using the changeset viewer.