Ignore:
Timestamp:
Jun 7, 2010, 9:20:00 AM (10 years ago)
Author:
roberth
Message:

Samples are now shown in the study overview page. Also some tests are added and the bootstrap is updated to show some sample fields with a template

Location:
trunk/grails-app/domain/dbnp/studycapturing
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/dbnp/studycapturing/Event.groovy

    r506 r536  
    8484        }
    8585
     86        def belongsToGroup( Set<EventGroup> groups ){
     87            def eventFound = false;
     88            def that = this;
     89            groups.each{ eventgroup ->
     90                if( !eventFound ) {
     91                    eventFound = ( that.id in eventgroup.events.id );
     92                }
     93            }
     94
     95            return eventFound;
     96        }
     97
    8698        def String toString() {
    8799                return fieldExists('Description') ? getFieldValue('Description') : ""
  • trunk/grails-app/domain/dbnp/studycapturing/Study.groovy

    r511 r536  
    6666        }
    6767
     68        /**
     69         * returns all events and sampling events that do not belong to a group
     70         */
     71        def Set<Event> getOrphanEvents() {
     72            def orphans =
     73                events.findAll{ event -> !event.belongsToGroup( eventGroups ) } +
     74                samplingEvents.findAll { event -> !event.belongsToGroup( eventGroups ) };
     75
     76            return orphans;
     77        }
     78
    6879        /**
    6980         * Return the unique Subject templates that are used in this study
  • trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy

    r507 r536  
    585585        /**
    586586         * Convenience method. Returns all unique templates used within a collection of TemplateEntities.
     587         *
     588         * If the collection is empty, an empty set is returned. If none of the entities contains
     589         * a template, also an empty set is returned.
    587590         */
    588591        static Set<Template> giveTemplates(Set<TemplateEntity> entityCollection) {
    589                 return entityCollection*.template.unique();
     592            def set = entityCollection*.template.unique();
     593
     594            // If one or more entities does not have a template, the resulting
     595            // set contains null. That is not what is meant.
     596            return set.findAll { it != null };
    590597        }
    591598
Note: See TracChangeset for help on using the changeset viewer.