Changeset 1610
- Timestamp:
- Mar 9, 2011, 9:28:13 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/SimpleWizardController.groovy
r1609 r1610 166 166 columns { 167 167 on( "next" ) { 168 flow.editImportedData = params.get( 'editAfterwards' ) ? true : false; 168 169 handleColumns( flow.study, params, flow ) ? success() : error() 169 170 }.to "checkImportedEntities" … … 174 175 action { 175 176 // Only continue to the next page if the information entered is correct 176 if( flow. imported.numInvalidEntities > 0 ) {177 if( flow.editImportedData || flow.imported.numInvalidEntities > 0 ) { 177 178 missingFields(); 178 179 } else { … … 271 272 flow.study.addToAssays( flow.assay ); 272 273 } 274 275 println "Events: " + flow.study.events 276 println "Samples: " + flow.study.samples 277 println "Eventgroups" + flow.study.eventGroups 273 278 274 279 if( flow.study.save( flush: true ) ) { … … 725 730 study.addToSamples( entity ); 726 731 } 732 733 // If an eventgroup is created, add it to the study 734 // The eventgroup must have a unique name, but the user shouldn't be bothered with it 735 // Add 'group ' + samplename and it that is not unique, add a number to it 736 if( entity.parentEventGroup ) { 737 study.addToEventGroups( entity.parentEventGroup ) 738 739 entity.parentEventGroup.name = "Group " + entity.name 740 while( !entity.parentEventGroup.validate() ) { 741 entity.parentEventGroup.getErrors().each { println it } 742 entity.parentEventGroup.name += "" + Math.floor( Math.random() * 100 ) 743 } 744 } 745 727 746 break; 728 747 case Subject: … … 737 756 break; 738 757 case SamplingEvent: 758 // Sampling events have a 'sampleTemplate' value, which should be filled by the 759 // template that is chosen for samples. 760 if( !entity.getFieldValue( 'sampleTemplate' ) ) { 761 entity.setFieldValue( 'sampleTemplate', flow.sampleForm.template.Sample.name ) 762 } 763 739 764 if( !preferredIdentifier || !study.samplingEvents?.find( equalClosure ) ) { 740 765 study.addToSamplingEvents( entity ); … … 925 950 // If no id is given for the subject, it has been entered in this wizard, but 926 951 // not yet saved. In that case, it is always OK 927 if( subject.id && eventGroup.subjects [0]?.id == subject.id )952 if( subject.id && eventGroup.subjects && eventGroup.subjects.toList()[0]?.id == subject.id ) 928 953 numEventGroups++ 929 954 } … … 944 969 // not yet saved. In that case, it is always OK 945 970 if( sample.parentSubject && sample.parentSubject.id) { 946 if( !sample.parentEventGroup.subjects || sample.parentEventGroup.subjects [0]?.id != sample.parentSubject.id ) {971 if( !sample.parentEventGroup.subjects || sample.parentEventGroup.subjects.toList()[0]?.id != sample.parentSubject.id ) { 947 972 flash.message = "The structure of the eventgroups of one or more samples is too complex" 948 973 simplicity = false; … … 953 978 // not yet saved. In that case, it is always OK 954 979 if( sample.parentEvent && sample.parentEvent.id) { 955 if( !sample.parentEventGroup.samplingEvents || sample.parentEventGroup.samplingEvents [0]?.id != sample.parentEvent.id ) {980 if( !sample.parentEventGroup.samplingEvents || sample.parentEventGroup.samplingEvents.toList()[0]?.id != sample.parentEvent.id ) { 956 981 flash.message = "The structure of the eventgroups of one or more samples is too complex" 957 982 simplicity = false; -
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r1609 r1610 232 232 'Subject': s?.parentSubject, 233 233 'SamplingEvent': s?.parentEvent, 234 'Event': s?.parentEventGroup?.events?. getAt(0)234 'Event': s?.parentEventGroup?.events?.toList()?.getAt(0) 235 235 ] 236 236 } -
trunk/grails-app/views/simpleWizard/simpleWizard/columns.gsp
r1609 r1610 88 88 </table> 89 89 </div> 90 91 <p> 92 <input type="checkbox" name="editAfterwards" value="1" /> Edit data after importing 93 </p> 90 94 </g:form> 91 95 -
trunk/grails-app/views/simpleWizard/simpleWizard/missingFields.gsp
r1609 r1610 9 9 <body> 10 10 <div class="simpleWizard"> 11 <h1> Missingproperties</h1>11 <h1>Edit properties</h1> 12 12 13 13 <g:if test="${error}"> … … 27 27 <span class="info"> 28 28 <span class="title">Fill in missing properties</span> 29 A number of records could not be succesfully imported. Fields giving an error are indicated by a red color. Please correct them before continuing. 29 <g:if test="${imported.numInvalidEntities > 0}"> 30 A number of records could not be succesfully imported. Fields giving an error are indicated by a red color. Please correct them before continuing. 31 </g:if> 32 <g:else> 33 The imported data is shown below. You can edit the data before continuing. 34 </g:else> 30 35 31 36 <g:if test="${imported.errors}"> -
trunk/grails-app/views/simpleWizard/simpleWizard/samples.gsp
r1609 r1610 59 59 </td> 60 60 </tr> 61 61 <tr> 62 <td> 63 <div id="datatemplate">Choose type of event template:</div> 64 </td> 65 <td> 66 <g:select rel="template" entity="${encodedEntity.Event}" name="event_template_id" noSelection="${[null: '- no event template -']}" optionKey="id" optionValue="name" from="${templates.Event}" value="${sampleForm?.templateId?.Event}" /> 67 </td> 68 </tr> 62 69 <tr> 63 70 <td>
Note: See TracChangeset
for help on using the changeset viewer.