Ignore:
Timestamp:
Mar 3, 2011, 11:17:40 PM (14 years ago)
Author:
gav
Message:

Update service, controller and view logic to hand Task and Entry highestSeverity.
Also remove associatedAssets from task search panes.

Location:
trunk/grails-app/controllers
Files:
2 edited

Legend:

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

    r833 r838  
    6767    }
    6868
     69    /// @todo: Refactor to taskService and include moving task to "In Progress" when Entry.duration is updated.
    6970    def update = {
    7071        def entryInstance = Entry.get( params.id )
     
    7475                entryInstance.properties = params
    7576                if(!entryInstance.hasErrors() && entryInstance.save(flush: true)) {
     77                    // If PM Entry update task.highestSeverity
     78                    if(entryInstance.entryType.id == 6) {
     79                        def clist = []
     80                        entryInstance.task.entries.each { entry ->
     81                            if(entry.entryType.id == 6)
     82                                clist << entry.highestSeverity
     83                        }
     84
     85                        if(clist)
     86                            entryInstance.task.highestSeverity = clist.sort{p1,p2 -> p2.id <=> p1.id}[0]
     87                    }
    7688                    flash.message = "Entry ${params.id} updated"
    7789                    redirect(action:show,id:entryInstance.id)
  • trunk/grails-app/controllers/TaskDetailedController.groovy

    r833 r838  
    185185        associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
    186186        associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
     187        def highestSeverityCodeQuery = 'select distinct cs.code from ConditionSeverity cs where cs.isActive = ? order by cs.code'
     188        associatedPropertyValues.highestSeverityList = ConditionSeverity.executeQuery(highestSeverityCodeQuery, [true], [max:associatedPropertyMax])
    187189        associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
    188190        associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
     
    342344        associatedPropertyValues.taskGroupList = TaskGroup.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
    343345        associatedPropertyValues.assetList = Asset.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
     346        def highestSeverityCodeQuery = 'select distinct cs.code from ConditionSeverity cs where cs.isActive = ? order by cs.code'
     347        associatedPropertyValues.highestSeverityList = ConditionSeverity.executeQuery(highestSeverityCodeQuery, [true], [max:associatedPropertyMax])
    344348        associatedPropertyValues.taskStatusList = TaskStatus.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
    345349        associatedPropertyValues.taskTypeList = TaskType.findAllByIsActive(true, [max:associatedPropertyMax, sort:'name'])
Note: See TracChangeset for help on using the changeset viewer.