Skip to content

Commit a94ee0e

Browse files
committed
2024-09-05 - feature-2583 - Modified ProgressBar
1 parent 3285b26 commit a94ee0e

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

server/src/main/java/com/objectcomputing/checkins/services/employee_hours/EmployeeHours.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.objectcomputing.checkins.services.employee_hours;
22

33
import com.objectcomputing.checkins.converter.LocalDateConverter;
4+
import com.objectcomputing.checkins.util.Util;
45
import io.micronaut.core.annotation.Introspected;
56
import io.micronaut.core.annotation.Nullable;
67
import 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

server/src/main/java/com/objectcomputing/checkins/util/Util.java

+7
Original file line numberDiff line numberDiff 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
}

web-ui/src/components/contribution_hours/ProgressBar.jsx

+3-6
Original file line numberDiff line numberDiff 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
);

0 commit comments

Comments
 (0)