source: trunk/grails-app/domain/dbnp/studycapturing/Sample.groovy @ 288

Last change on this file since 288 was 288, checked in by jahn, 8 years ago

Event's create and edit action have been tested and are now working.

Also, the old problem of adding Samples has been addressed. When a new event is created as a SamplingEvent?, no new samples can be added directly. The reason for this is, that the event is not yet assigned to any Subject, and thus the non nullable subject field of a new sample (belonging to the new event) cannot be filled.
Similarly, when a SamplingEvent? event is edited, new samples can only be added, if the event already is assigned to belong to a subject. New samples are always added to the same subject as the first (random) sample belonging to the SamplingEvent?.

However, there are still open questions:

(1) Should the sample also be assigned to the samples of its subject's Study?

(2) Should a sample also be assigned, if there are no samples assigned yet, but there is a subject assigned to this event?

(3) Should the user be allowed to chose to assign a subject if the event is assigned to a Study that contains multiple subjects?

  • Property svn:keywords set to Author Rev Date
File size: 652 bytes
1package dbnp.studycapturing
6 * The Sample class describes an actual sample which results from a SamplingEvent.
7 */
8class Sample extends TemplateEntity {
9        static searchable = true
11        Subject parentSubject
12        SamplingEvent parentEvent
14        String name      // should be unique with respect to the parent study (which can be inferred)
15        Term material
16        // a member that describes the quantity of the sample? --> should be in the templates
18        static constraints = {
19                parentSubject(nullable:true)
20        }
22        static getSamplesFor( event ) {
23            return  Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] )
24        }
Note: See TracBrowser for help on using the repository browser.