File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed
server/src/main/java/com/objectcomputing/checkins
web-ui/src/components/contribution_hours Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 11package com .objectcomputing .checkins .services .employee_hours ;
22
33import com .objectcomputing .checkins .converter .LocalDateConverter ;
4+ import com .objectcomputing .checkins .util .Util ;
45import io .micronaut .core .annotation .Introspected ;
56import io .micronaut .core .annotation .Nullable ;
67import io .micronaut .data .annotation .AutoPopulated ;
@@ -117,8 +118,8 @@ public boolean equals(Object o) {
117118 updatedDate .equals (that .updatedDate ) &&
118119 Float .compare (that .targetHours , targetHours ) == 0 &&
119120 asOfDate .equals (that .asOfDate ) &&
120- Float . compare (that .billableUtilization , this .billableUtilization ) == 0 &&
121- Float . compare (that .overtimeWorked , this .overtimeWorked ) == 0
121+ Util . floatCompareNullSafeAndEqualWhenBothNull (that .billableUtilization , this .billableUtilization ) == 0 &&
122+ Util . floatCompareNullSafeAndEqualWhenBothNull (that .overtimeWorked , this .overtimeWorked ) == 0
122123 ;
123124 }
124125
Original file line number Diff line number Diff line change @@ -31,4 +31,11 @@ public static List<String> nullSafeUUIDListToStringList(List<UUID> uuidList) {
3131 }
3232 return stringsList ;
3333 }
34+
35+ public static int floatCompareNullSafeAndEqualWhenBothNull (Float f1 , Float f2 ) {
36+ if (f1 == null && f2 == null ) return 0 ;
37+ if (f1 == null || f2 == null ) return 1 ;
38+ return Float .compare (f1 , f2 );
39+ }
40+
3441}
Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ const LinearBuffer = ({
4444 contributionHours = 925 ,
4545 targetHours = 1850 ,
4646 ptoHours = 0 ,
47- billableUtilization = 0 ,
48- overtimeWorked = 0 ,
47+ billableUtilization,
48+ overtimeWorked,
4949} ) => {
5050 return (
5151 < Root className = { classes . root } >
@@ -67,10 +67,7 @@ const LinearBuffer = ({
6767 style = { { display : 'block' } }
6868 >
6969 Billable Hours: { billableHours } - Contribution Hours:{ ' ' }
70- { contributionHours } - Target Hours: { targetHours } - PTO Hours:{ ' ' }
71- { ptoHours } - Billable Utilization:{ ' ' }
72- { billableUtilization } - Overtime Worked:{ ' ' }
73- { overtimeWorked }
70+ { contributionHours } - Target Hours: { targetHours } - PTO Hours:{ ' ' } { ptoHours } - Billable Utilization:{ ' ' } { ( billableUtilization ) ? billableUtilization : '(none)' } - Overtime Worked:{ ' ' } { ( overtimeWorked ) ? overtimeWorked : '(none)' }
7471 </ Typography >
7572 </ Root >
7673 ) ;
You can’t perform that action at this time.
0 commit comments