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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.