Changeset 510


Ignore:
Timestamp:
Jun 2, 2010, 4:38:09 PM (13 years ago)
Author:
duh
Message:
  • wizard saving second version
Location:
trunk/grails-app
Files:
3 edited

Legend:

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

    r509 r510  
    497497                                        println ".saving wizard data..."
    498498
    499                                         // save events
    500                                         println ".saving events"
     499                                        // add events to study
     500                                        println ".add events to study"
    501501                                        flow.events.each() { event ->
    502                                                 if (!event.save(flush:true)) {
    503                                                         this.appendErrors(event, flash.errors)
    504                                                         throw new Exception('error saving event')
    505                                                 }
    506 
    507                                                 // add to study
    508502                                                if (event instanceof SamplingEvent) {
    509503                                                        flow.study.addToSamplingEvents(event)
     
    511505                                                        flow.study.addToEvents(event)
    512506                                                }
    513                                                
    514                                                 println ".saved event ["+event+"] of type ["+event.getClass()+"] (id: "+event.id+")"
    515507                                        }
    516508
    517                                         // save subjects
    518                                         println ".saving subjects"
     509                                        // add subjects to study
     510                                        println ".add subjects to study"
    519511                                        flow.subjects.each() { subjectId, subject ->
    520                                                 if (!subject.save(flush:true)) {
    521                                                         this.appendErrors(subject.value, flash.errors)
    522                                                         throw new Exception('error saving subject')
    523                                                 }
    524 
    525                                                 // add this subject to the study
    526512                                                flow.study.addToSubjects(subject)
    527 
    528                                                 println ".saved subject "+subject+" (id: "+subject.id+")"
    529513                                        }
    530514
    531                                         // save eventGroups
    532                                         println ".saving eventGroups"
     515                                        // add eventGroups to study
     516                                        println ".add eventGroups to study"
    533517                                        flow.eventGroups.each() { eventGroup ->
    534                                                 if (!eventGroup.save(flush:true)) {
    535                                                         this.appendErrors(eventGroup, flash.errors)
    536                                                         throw new Exception('error saving eventGroup')
    537                                                 }
    538 
    539                                                 // add to study
    540518                                                flow.study.addToEventGroups(eventGroup)
    541 
    542                                                 println ".saved eventGroup ["+eventGroup+"] (id: "+eventGroup.id+")"
    543519                                        }
    544520
  • trunk/grails-app/domain/dbnp/studycapturing/Study.groovy

    r506 r510  
    2121         * @return List
    2222         */
    23         static List<TemplateField> giveDomainFields() { return Study.domainFields }
     23        static List<TemplateField> giveDomainFields() { return Study.domainFields }
    2424
    25         static final List<TemplateField> domainFields =
    26                 [
    27                         new TemplateField(
    28                                 name: 'title',
    29                                 type: TemplateFieldType.STRING),
    30                         new TemplateField(
    31                                 name: 'startDate',
    32                                 type: TemplateFieldType.DATE,
    33                                 comment: 'Fill out the official start date or date of first action')
    34                 ]
     25        static final List<TemplateField> domainFields =
     26        [
     27                new TemplateField(
     28                        name: 'title',
     29                        type: TemplateFieldType.STRING),
     30                new TemplateField(
     31                        name: 'startDate',
     32                        type: TemplateFieldType.DATE,
     33                        comment: 'Fill out the official start date or date of first action')
     34        ]
    3535
    3636        static hasMany = [
     
    8181        }
    8282
    83 
    8483        /**
    8584         * Return the unique Event templates that are used in this study
  • trunk/grails-app/views/wizard/pages/_events.gsp

    r455 r510  
    6767        <g:each var="eventTemplate" in="${eventTemplates}">
    6868                <g:set var="showHeader" value="${true}" />
    69                 <h1>${eventTemplate.getValue().name} template</h1>
     69                <h1>${eventTemplate.getValue().name}</h1>
    7070        <div class="table">
    7171                <g:each var="eventId" in="${eventTemplate.getValue().events}">
Note: See TracChangeset for help on using the changeset viewer.