1
1
package com .objectcomputing .checkins .services .employee_hours ;
2
2
3
3
import com .objectcomputing .checkins .converter .LocalDateConverter ;
4
+ import com .objectcomputing .checkins .util .Util ;
4
5
import io .micronaut .core .annotation .Introspected ;
6
+ import io .micronaut .core .annotation .Nullable ;
5
7
import io .micronaut .data .annotation .AutoPopulated ;
6
8
import io .micronaut .data .annotation .TypeDef ;
7
9
import io .micronaut .data .model .DataType ;
@@ -74,7 +76,19 @@ public class EmployeeHours {
74
76
@ TypeDef (type = DataType .DATE , converter = LocalDateConverter .class )
75
77
private LocalDate asOfDate ;
76
78
77
- public EmployeeHours (UUID id , @ NotNull String employeeId , @ NotNull Float contributionHours , Float billableHours , Float ptoHours , LocalDate updatedDate , Float targetHours , LocalDate asOfDate ) {
79
+ @ Column (name ="billable_utilization" )
80
+ @ TypeDef (type = DataType .FLOAT )
81
+ @ Schema (description ="Billable utilization hours" )
82
+ @ Nullable
83
+ private Float billableUtilization ;
84
+
85
+ @ Column (name ="overtime_worked" )
86
+ @ TypeDef (type = DataType .FLOAT )
87
+ @ Schema (description ="Number of hours of overtime worked" )
88
+ @ Nullable
89
+ private Float overtimeWorked ;
90
+
91
+ public EmployeeHours (UUID id , @ NotNull String employeeId , @ NotNull Float contributionHours , Float billableHours , Float ptoHours , LocalDate updatedDate , Float targetHours , LocalDate asOfDate , @ Nullable Float billableUtilization , @ Nullable Float overtimeWorked ) {
78
92
this .id = id ;
79
93
this .employeeId = employeeId ;
80
94
this .contributionHours = contributionHours ;
@@ -83,10 +97,12 @@ public EmployeeHours(UUID id, @NotNull String employeeId, @NotNull Float contrib
83
97
this .updatedDate = updatedDate ;
84
98
this .targetHours = targetHours ;
85
99
this .asOfDate = asOfDate ;
100
+ this .billableUtilization = billableUtilization ;
101
+ this .overtimeWorked = overtimeWorked ;
86
102
}
87
103
88
- public EmployeeHours (@ NotNull String employeeId , @ NotNull Float contributionHours , @ NotNull Float billableHours , @ NotNull Float ptoHours , LocalDate updatedDate , @ NotNull Float targetHours , LocalDate asOfDate ) {
89
- this (null , employeeId , contributionHours , billableHours , ptoHours , updatedDate , targetHours , asOfDate );
104
+ public EmployeeHours (@ NotNull String employeeId , @ NotNull Float contributionHours , @ NotNull Float billableHours , @ NotNull Float ptoHours , LocalDate updatedDate , @ NotNull Float targetHours , LocalDate asOfDate , @ Nullable Float billableUtilization , @ Nullable Float overtimeWorked ) {
105
+ this (null , employeeId , contributionHours , billableHours , ptoHours , updatedDate , targetHours , asOfDate , billableUtilization , overtimeWorked );
90
106
}
91
107
92
108
@ Override
@@ -101,12 +117,15 @@ public boolean equals(Object o) {
101
117
employeeId .equals (that .employeeId ) &&
102
118
updatedDate .equals (that .updatedDate ) &&
103
119
Float .compare (that .targetHours , targetHours ) == 0 &&
104
- asOfDate .equals (that .asOfDate ) ;
120
+ asOfDate .equals (that .asOfDate ) &&
121
+ Util .floatCompareNullSafeAndEqualWhenBothNull (that .billableUtilization , this .billableUtilization ) == 0 &&
122
+ Util .floatCompareNullSafeAndEqualWhenBothNull (that .overtimeWorked , this .overtimeWorked ) == 0
123
+ ;
105
124
}
106
125
107
126
@ Override
108
127
public int hashCode () {
109
- return Objects .hash (id , employeeId , contributionHours , billableHours , ptoHours , updatedDate ,targetHours , asOfDate );
128
+ return Objects .hash (id , employeeId , contributionHours , billableHours , ptoHours , updatedDate ,targetHours , asOfDate , billableUtilization , overtimeWorked );
110
129
}
111
130
112
131
@ Override
@@ -120,6 +139,8 @@ public String toString() {
120
139
", updatedDate=" + updatedDate +
121
140
", targetHours=" + targetHours +
122
141
", asOfDate=" + asOfDate +
142
+ ", billableUtilization=" + this .billableUtilization +
143
+ ", overtimeWorked=" + this .overtimeWorked +
123
144
'}' ;
124
145
}
125
146
}
0 commit comments