Changeset 170
- Timestamp:
- Feb 3, 2010, 6:08:33 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/EventController.groovy
r162 r170 66 66 67 67 68 // This action is not complete yet.69 // (1) Need to include Sampling events.70 // (2) This probably causes orphened PrtocolPrameters that have to be delt with.71 // (3) Parts of this might have to be moved into the Domain object's save() method.72 // (4) The correspoding view's params are bloated and contain redundancy.73 // (5) The whole thing should be moved to update.74 // (6) A "create" should be added.75 68 76 69 def save = { … … 78 71 def event = Event.get(params["id"]) 79 72 80 81 if( event==null ) { // this is an entirely new event 73 if( event==null ) { // this is an entirely new event 82 74 render(action: "list", total:Event.count() ) 83 75 } 84 76 85 params["startTime"] = parseDate(params["startTime"]) // parse the date strings77 params["startTime"] = parseDate(params["startTime"]) // parse the date strings 86 78 params["endTime"] = parseDate(params["endTime"]) 87 79 … … 93 85 def protocolParameters = params["protocolParameter"] 94 86 95 96 if(oldProtocol<=>newProtocol) { // protocol id changed 87 println "\n\nparams" 88 params.each{ println it } 89 90 if(oldProtocol<=>newProtocol) { // protocol id changed 97 91 event.eventDescription=EventDescription.get(newProtocol) 98 92 event.parameterStringValues.clear() // this does not propagate orphened parameters 99 93 def protocol=Protocol.get(newProtocol) 100 94 protocolParameters.each{ key, value -> 101 def parameter=ProtocolParameter.get(key) 102 event.parameterStringValues[ key] = value95 def parameter=ProtocolParameter.get(key).name 96 event.parameterStringValues[parameter] = value 103 97 } 98 println event.parameterStringValues 99 event.eventDescription.protocol=protocol 104 100 } 105 101 else // protocol is the same, values changed … … 107 103 protocolParameters.each{ key, value -> 108 104 def parameter=ProtocolParameter.get(key) 109 event.parameterStringValues[ key]=value105 event.parameterStringValues[parameter.name]=value // changed from key to id 110 106 } 111 107 112 108 } 113 109 114 println "parameterStringValues: " + event.parameterStringValues115 116 println "Old Protocol: " + event.eventDescription.protocol.id117 println "New Protocol: " + params["protocol.id"]118 119 120 println "Old: "121 println event.parameterStringValues.each {122 k,v -> println "${k}: ${v}\n"123 }124 125 println "New:"126 protocolParameters.each{127 k,v -> println "${k}: ${v}\n"128 }129 110 130 111 if (event.save(flush: true)) { … … 171 152 172 153 154 155 // This action is not complete yet. 156 // (1) Need to include SamplingEvents. 157 // (2) This probably causes orphened PrtocolPrameters that have to be delt with. 158 // The orphanes have to be managed centrally with the Protocols. 159 // (3) Parts of this might have to be moved into the Domain object's save() method. 160 // (4) The correspoding view's params are bloated and contain redundancy. 161 // (5) The whole thing should be moved to update. 162 // (6) A "create" should be added. 173 163 174 164 def edit = { … … 223 213 } 224 214 215 225 216 def delete = { 226 217 def eventInstance = Event.get(params.id)
Note: See TracChangeset
for help on using the changeset viewer.