Ignore:
Timestamp:
Oct 3, 2009, 4:05:02 PM (15 years ago)
Author:
gav
Message:

Work on TaskSearchService?.

File:
1 edited

Legend:

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

    r143 r144  
    1919
    2020    def search = {
     21//         println params
    2122        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100 )
    2223
     24        // Search urls:
    2325        if(!params.filter)
    2426        {
    25 //             if(params.searchMyTodays) { def taskInstanceList = taskSearchService.getMyTodays(params) }
    26 //             else { def taskInstanceList = taskSearchService.getTodays(params) }
    27            
    28             def taskInstanceList = taskSearchService.getTodays(params)
    29 
    30             if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks" }
    31             else { params.message = "No tasks found for today" }
     27            def taskInstanceList = []
     28            def personInstance = Person.get(authenticateService.userDomain().id)
     29
     30            if(params.searchMyTodays) {
     31                taskInstanceList = taskSearchService.getMyTodays(params)
     32                if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks for ${personInstance.firstName} ${personInstance.lastName}." }
     33                else { params.message = "No tasks found for today." }
     34            }
     35            else if(params.searchInTheLastWeek) {
     36                taskInstanceList = taskSearchService.getInTheLastWeek(params)
     37                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week." }
     38                else { params.message = "No tasks found for today." }
     39            }
     40            else if(params.searchMyInTheLastWeek) {
     41                taskInstanceList = taskSearchService.getMyInTheLastWeek(params)
     42                if(taskInstanceList.totalCount > 0) { params.message = "Tasks with Target Start Date in the last week for ${personInstance.firstName} ${personInstance.lastName}." }
     43                else { params.message = "No tasks found for today." }
     44            }
     45            else {
     46                //Default:
     47                taskInstanceList = taskSearchService.getTodays(params)
     48                if(taskInstanceList.totalCount > 0) { params.message = "Today's tasks." }
     49                else { params.message = "No tasks found for today." }
     50            }
     51
    3252            return[ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.totalCount]
    3353        }
Note: See TracChangeset for help on using the changeset viewer.