Changeset 805
- Timestamp:
- Aug 12, 2010, 5:50:54 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r803 r805 425 425 def eventGroupToRemove = flow.study.eventGroups.find { it.getIdentifier() == (params.get('do') as int) } 426 426 if (eventGroupToRemove) { 427 flow.study.deleteEventGroup( eventGroupToRemove )427 println flow.study.deleteEventGroup( eventGroupToRemove ) 428 428 } 429 429 }.to "events" -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r796 r805 242 242 return msg 243 243 } 244 244 245 /** 245 246 * Delete an eventGroup from the study, including all its relations … … 248 249 */ 249 250 String deleteEventGroup(EventGroup eventGroup) { 251 // TODO THIS DOESNT WORK!!!! 252 println "-" 253 println "-" 254 println "-" 255 println "-" 256 println "-" 257 println "REMOVING AND ENENTGROUP DOES NOT DELETE SAMPLES" 258 println "-" 259 println "-" 260 println "-" 261 println "-" 262 println "-" 263 264 265 250 266 String msg = "EventGroup ${eventGroup} was deleted" 267 268 // remove all samples that originate from this eventGroup 269 if (eventGroup.samplingEvents.size()) { 270 // find all samples related to this eventGroup 271 // - subject comparison is relatively straightforward and 272 // behaves as expected 273 // - event comparison behaves strange, so now we compare 274 // 1. database id's or, 275 // 2. object identifiers or, 276 // 3. objects itself 277 // this seems now to work as expected 278 this.samples.findAll { sample -> 279 ( 280 (eventGroup.subjects.findAll { 281 it.equals(sample.parentSubject) 282 }) 283 && 284 (eventGroup.samplingEvents.findAll { 285 ( 286 (it.id && sample.parentEvent.id && it.id==sample.parentEvent.id) 287 || 288 (it.getIdentifier() == sample.parentEvent.getIdentifier()) 289 || 290 it.equals(sample.parentEvent) 291 ) 292 }) 293 ) 294 }.each() { 295 // remove sample from study 296 println ".removing sample "+it 297 this.removeFromSamples( it ) 298 } 299 } 300 301 // remove all samplingEvents from this eventGroup 302 eventGroup.samplingEvents.findAll{}.each() { eventGroup.removeFromSamplingEvents(it) } 303 304 // remove all subject from this eventGroup 305 eventGroup.subjects.findAll{}.each() { eventGroup.removeFromSubjects(it) } 251 306 252 307 // remove the eventGroup from the study -
trunk/grails-app/views/study/show.gsp
r754 r805 464 464 </g:if> 465 465 <td>${event.getStartTimeString()}</td> 466 <td>${ event.getDurationString()}</td>466 <td>${((event.getClass() == 'Event') ? event.getDurationString() : '')}</td> 467 467 <td>${event.template.name}</td> 468 468 <td>
Note: See TracChangeset
for help on using the changeset viewer.