Changeset 708 for trunk/grails-app/services/TaskReportService.groovy
- Timestamp:
- Nov 15, 2010, 11:48:34 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/TaskReportService.groovy
r651 r708 24 24 def result = [:] 25 25 26 def fail = { Map m -> 27 result.error = [ code: m.code, args: [] ] 28 return result 29 } 30 26 31 def namedParams = [:] 27 32 namedParams.startDate = params.startDate ?: dateUtilService.today 28 33 namedParams.endDate = params.endDate ?: dateUtilService.today 34 35 if(namedParams.endDate < namedParams.startDate) 36 return fail(code: "default.end.date.before.start.date") 37 29 38 namedParams.endDate++ // Start of next day required. 39 30 40 namedParams.immediateCallout = TaskType.read(1) 31 41 namedParams.unscheduledBreakin = TaskType.read(2) … … 94 104 } 95 105 catch(ArithmeticException e) { 96 log. error"Could not calculate: Assets on Tasks Percentages: "+e106 log.info "Could not calculate: Assets on Tasks Percentages: "+e 97 107 } 98 108 99 109 // Work Done. 100 result.immediateCalloutWorkDone = [total:0, hours:0, minutes:0, percentage: 0]110 result.immediateCalloutWorkDone = [total:0, hours:0, minutes:0, percentage: new BigDecimal(0)] 101 111 result.unscheduledBreakinWorkDone = [total:0, hours:0, minutes:0] 102 112 result.preventativeMaintenanceWorkDone = [total:0, hours:0, minutes:0] 103 result.totalPreventativeWorkDone = [total:0, hours:0, minutes:0, percentage: 0]113 result.totalPreventativeWorkDone = [total:0, hours:0, minutes:0, percentage: new BigDecimal(0)] 104 114 result.totalWorkDone = [total:0, hours:0, minutes:0] 105 115 … … 139 149 // Work Done Percentages. 140 150 try { 141 result.immediateCalloutWorkDone.percentage = ( result.immediateCalloutWorkDone.total / result.totalWorkDone.total)*100142 result.totalPreventativeWorkDone.percentage = ( result.totalPreventativeWorkDone.total / result.totalWorkDone.total)*100151 result.immediateCalloutWorkDone.percentage = (BigDecimal)(result.immediateCalloutWorkDone.total / result.totalWorkDone.total)*100 152 result.totalPreventativeWorkDone.percentage = (BigDecimal)(result.totalPreventativeWorkDone.total / result.totalWorkDone.total)*100 143 153 } 144 154 catch(ArithmeticException e) { 145 log. error"Could not calculate: Work Done Percentages: "+e155 log.info "Could not calculate: Work Done Percentages: "+e 146 156 } 147 157
Note: See TracChangeset
for help on using the changeset viewer.