Changeset 1031


Ignore:
Timestamp:
Nov 1, 2010, 2:54:35 PM (6 years ago)
Author:
robert@…
Message:

Bug in study comparison view fixed, so multiple studies can be compared

Location:
trunk/grails-app
Files:
2 edited

Legend:

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

    r976 r1031  
    7474     */
    7575    def list_extended = {
     76                // If nothing has been selected, redirect the user
     77                if( !params.id )
     78                        redirect( action: 'list' )
     79
     80                // Check whether one id has been selected or multiple.
     81                def ids = params.id
     82                if( ids instanceof String )
     83                        redirect( action: 'show', id: ids )
     84
     85                // Parse strings to a long
     86                def long_ids = []
     87                ids.each { long_ids.add( Long.parseLong( it ) ) }
     88
     89                println( long_ids )
     90
    7691        def startTime = System.currentTimeMillis()
    77         params.max = Math.min(params.max ? params.int('max') : 10, 100)
    78        
    79         def studyList = Study.list(params)
     92                def c = Study.createCriteria()
     93
     94        def studyList = c {
     95                        maxResults( Math.min(params.max ? params.int('max') : 10, 100) )
     96                        'in'( "id", long_ids )
     97                }
    8098        render(view:'show',model:[studyList: studyList, studyInstanceTotal: Study.count(), multipleStudies: ( studyList.size() > 1 ) ] )
    8199    }
  • trunk/grails-app/views/study/list.gsp

    r976 r1031  
    3434              <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
    3535
    36                   <td><input type="checkbox" name="${studyInstance.title}" id="${studyInstance.title}"></td>
     36                  <td><input type="checkbox" name="id" value="${studyInstance.id}" id="${studyInstance.title}"></td>
    3737
    3838                  <td><g:link action="show" id="${studyInstance.id}">${fieldValue(bean: studyInstance, field: "code")}</g:link></td>
Note: See TracChangeset for help on using the changeset viewer.