Changeset 665


Ignore:
Timestamp:
Jul 19, 2010, 6:44:40 PM (13 years ago)
Author:
duh
Message:
  • dev commit
File:
1 edited

Legend:

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

    r664 r665  
    677677                                                                        flow.samples[ incrementor ] = [
    678678                                                                                sample: new Sample(
     679                                                                                        parent: flow.study,
    679680                                                                                        parentSubject: subject,
    680681                                                                                        parentEvent: event,
     
    732733                        on("regenerate") {
    733734                                println ".removing 'samples' and 'sampleTemplates' from the flowscope, triggering regeneration of the samples..."
     735                                flow.samples.each() {
     736                                        flow.study.removeFromSamples( it.sample )
     737                                }
    734738                                flow.remove('samples')
    735739                                flow.remove('sampleTemplates')
     740                                println flow.study.samples
    736741                                success()
    737742                        }.to "samples"
     
    808813                                // persist data to the database
    809814                                try {
    810                                         println ".saving wizard data..."
    811 
    812                                         // add events to study
    813                                         /*
    814                                         println ".add events to study"
    815                                         flow.events.each() { event ->
    816                                                 if (event instanceof SamplingEvent) {
    817                                                         // only add this sampling event if it is not yet
    818                                                         // linked to this study
    819                                                         if (!flow.study.samplingEvents.find { e -> (e == event) }) {
    820                                                                 flow.study.addToSamplingEvents( event.value )
    821                                                         }
    822                                                 } else {
    823                                                         // only add it if it does not yet exist
    824                                                         if (!flow.study.events.find { e -> (e == event) }) {
    825                                                                 flow.study.addToEvents( event.value )
    826                                                         }
    827                                                 }
    828                                         }
    829 
    830                                         // add subjects to study
    831                                         println ".add subjects to study"
    832                                         flow.subjects.each() { subjectId, subject ->
    833                                                 // add subject to study if it is not yet in this study
    834                                                 if (!flow.study.subjects.find { s -> (s == subject) }) {
    835                                                         flow.study.addToSubjects(subject)
    836                                                 }
    837                                         }
    838 
    839                                         // add eventGroups to study
    840                                         println ".add eventGroups to study"
    841                                         flow.eventGroups.each() { eventGroup ->
    842                                                 // only add the eventGroup if it is not yet linked
    843                                                 if (!flow.study.eventGroups.find { e -> (e == eventGroup) }) {
    844                                                         flow.study.addToEventGroups(eventGroup)
    845                                                 }
    846                                         }
    847                                         */
    848 
    849815                                        // save study
    850816                                        println ".saving study"
    851                                         if (!flow.study.save(flush:true)) {
     817                                        if (!flow.study.save()) {
    852818                                                this.appendErrors(flow.study, flash.errors)
    853819                                                throw new Exception('error saving study')
Note: See TracChangeset for help on using the changeset viewer.