Changeset 585


Ignore:
Timestamp:
Jun 8, 2010, 10:41:21 PM (14 years ago)
Author:
gav
Message:

First draft of displaying work load on task calendar, see ticket #66.

Location:
trunk
Files:
3 added
3 edited

Legend:

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

    r582 r585  
    1010    def taskService
    1111    def taskSearchService
     12    def taskReportService
    1213    def filterService
    1314    def exportService
     
    197198        params.max = Math.min( params.max ? params.max.toInteger() : 100,  1000 )
    198199
     200        def displayList = []
    199201        def taskInstanceList = []
    200202        def taskInstanceTotal
     
    261263        }
    262264
     265        displayList = taskReportService.getWorkLoadSummary(
     266                                    [taskInstanceList: taskInstanceList], RCU.getLocale(request)
     267                                ).displayList
     268
    263269        // export plugin:
    264270        if(params?.format && params.format != "html") {
     
    286292        }
    287293
    288         if(taskInstanceTotal > params.max)
    289             params.errorMessage = g.message(code:"task.search.calendar.text.too.many.results", args:[params.max])
     294//         if(taskInstanceTotal > params.max)
     295//             params.errorMessage = g.message(code:"task.search.calendar.text.too.many.results", args:[params.max])
    290296
    291297        // Add some basic params to filterParams.
     
    293299        filterParams.offset = params.offset?.toInteger() ?: 0
    294300
    295         return[taskInstanceList: taskInstanceList,
     301        return[displayList: displayList,
     302                        taskInstanceList: taskInstanceList,
    296303                        taskInstanceTotal: taskInstanceTotal,
    297304                        filterParams: filterParams,
  • trunk/grails-app/services/TaskReportService.groovy

    r545 r585  
     1import org.gnumims.RichUiCalendarItem
    12
    23/**
     
    256257    } // getImmediateCallouts()
    257258
     259    /**
     260    * Builds and returns a list of RichUiCalendarItem's.
     261    * @param params The request params, may contain params to specify the search.
     262    * @param locale The locale to use when generating result.message.
     263    */
     264    def getWorkLoadSummary(params, locale) {
     265
     266        def result = [:]
     267        result.displayList = []
     268
     269        def listItem
     270
     271        def dayMap = [:]
     272        def assignedGroupMap = [:]
     273
     274        params.taskInstanceList.each { task ->
     275            def dayKey = task.targetStartDate /// @todo: make this key more stable.
     276            def assignedTime = 0
     277
     278            task.assignedGroups.each{ assignedGroup ->
     279                assignedTime = assignedGroup.estimatedHour*60 + assignedGroup.estimatedMinute
     280            }
     281
     282            if(dayMap.containsKey(dayKey)) {
     283                if(task.description) {
     284                    dayMap[dayKey] = dayMap[dayKey] + assignedTime
     285                }
     286            }
     287            else {
     288                dayMap[(dayKey)] = assignedTime
     289            }
     290        }
     291
     292        dayMap.each { k, v ->
     293                listItem = new RichUiCalendarItem(date:k, text:('assignedTime: '+v.toString()))
     294                result.displayList << listItem
     295        }
     296
     297        // Success.
     298        return result
     299
     300    } // getWorkLoadSummary()
    258301
    259302} // end class
  • trunk/grails-app/views/taskDetailed/searchCalendar.gsp

    r570 r585  
    101101                    <br />
    102102
    103                 <richui:calendarMonthView items="${taskInstanceList}"
    104                                                                         createLink="true"
    105                                                                         constraintDateFields="['targetStartDate']"
     103                <richui:calendarMonthView items="${displayList}"
     104                                                                        displayField="text"
     105                                                                        createLink="false"
     106                                                                        constraintDateFields="['date']"
    106107                                                                        month="${showDate}"
    107108                                                                        controller="taskDetailed"
Note: See TracChangeset for help on using the changeset viewer.