Ignore:
Timestamp:
Mar 26, 2010, 1:02:39 PM (14 years ago)
Author:
ademcan
Message:

queryController changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/SearchableController.groovy

    r247 r316  
    1 
    21/*
    32 * Copyright 2007 the original author or authors.
     
    2120 * Basic web interface for Grails Searchable Plugin
    2221 *
    23  * @author Adem and Jahn
     22 * @author Maurice Nicholson
    2423 */
    2524class SearchableController {
    2625    def searchableService
    27 
    28     def selectsample = {
    29 
    30 
    31             // produce error message here if studies don't contain samples!
    32             // redirect back or use error
    33 
    34 
    35             println "in selectsample: "
    36             params.each{println it}
    37 
    38             // prepare showing all studies selected in the previous view
    39             def selectedStudies = []
    40             def selectedStudyIds = params['selectedStudyIds']
    41 
    42             if(selectedStudyIds!=null)
    43             {
    44                  def list = selectedStudyIds.findAll(/(\d)+/)
    45                  selectedStudies = list.collect{ dbnp.studycapturing.Study.get(it) }
    46             }
    47             else
    48             {
    49                  def tmpList = []
    50                  def studyList = dbnp.studycapturing.Study.list()
    51                  selectedStudyIds = []
    52                  params.each{ key,values->
    53                      if (values=="on")  tmpList.add(key)
    54                  }
    55 
    56                  for (i in studyList)
    57                      if (tmpList.contains(i.getId().toString()))
    58                      {
    59                          selectedStudyIds.add(i.id)
    60                          selectedStudies.add(i)
    61                      }
    62            }
    63 
    64 
    65         // subgroups
    66         // provide list of subgroups depending on the type of subgrouping
    67         // selected by the user
    68         def subgroups = []
    69         def submitButton = params["submit"]  // this button's value determines the kind of subgrouping
    70 
    71         switch(submitButton)
    72         {
    73              case "Subject Groups":
    74                   render(params)
    75                   render("Subject Groups")
    76                   def studyGroups = []
    77                   if(selectedStudies!=null)
    78                   {
    79                      selectedStudies.each{ study ->
    80                          study.groups.each{ group -> studyGroups.add[group] }
    81                      }
    82                      println "study groups: "
    83                      studyGroups.each{x-> println x}
    84                   }
    85 
    86                   // testing:
    87                   // there is a lack of data in the mockup (subject groups are still missing)
    88                   // as long as there are no groups in the boot script,
    89                   // we use this
    90                   subgroups = studyGroups.size()<=0 ?
    91                        ["subject group 1","subject group 2"] : studyGroups
    92 
    93                   render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    94                   break
    95 
    96              case "Event Groups":
    97                   def eventGroups = []
    98                   if(selectedStudies!=null)
    99                   {
    100                     selectedStudies.each{ study ->
    101                          println study.id
    102                          println study.samplingEvents.each{ eventGroups.add(it) }
    103                     }
    104                   }
    105                   subgroups=eventGroups
    106                   render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    107                   break
    108 
    109              case "Starting Time Groups":
    110 
    111                   def timeGroups = []
    112                   if(selectedStudies!=null)
    113                   {
    114                     selectedStudies.each{ study ->
    115                          println study.samplingEvents.each{
    116                              def timeDiff = it.getPrettyDuration( study.startDate, it.startTime )
    117                              if( !timeGroups.contains(timeDiff) ) timeGroups.add(timeDiff)
    118                          }
    119                     }
    120                   }
    121                   subgroups=timeGroups
    122                   render("Starting Time Groups")
    123                   render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    124                   break
    125 
    126              case ">> Execute and continue with biomarker selection":
    127                   render("Starting Time Groups")
    128                   break
    129              case "<< Back to study selection":
    130                   break
    131         }
    132         render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])
    133     }
    134 
    135 
    13626
    13727    /**
     
    16656        render("unindexAll done")
    16757    }
    168 
    169 
    170     def subjectGroups = { render ("hello") }
    171 
    172 
    17358}
Note: See TracChangeset for help on using the changeset viewer.