mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Performance optimization for import
This commit is contained in:
committed by
Constantin Graf
parent
90480f3bb8
commit
0eef5ffcfa
@@ -12,6 +12,27 @@ use App\Models\TimeEntry;
|
||||
|
||||
class BillableRateService
|
||||
{
|
||||
public function getBillableRateForTimeEntryWithGivenRelations(TimeEntry $timeEntry, ?ProjectMember $projectMember, ?Project $project, ?Member $member, ?Organization $organization): ?int
|
||||
{
|
||||
if (! $timeEntry->billable) {
|
||||
return null;
|
||||
}
|
||||
if ($projectMember !== null && $projectMember->billable_rate !== null) {
|
||||
return $projectMember->billable_rate;
|
||||
}
|
||||
if ($project !== null && $project->billable_rate !== null) {
|
||||
return $project->billable_rate;
|
||||
}
|
||||
if ($member !== null && $member->billable_rate !== null) {
|
||||
return $member->billable_rate;
|
||||
}
|
||||
if ($organization !== null && $organization->billable_rate !== null) {
|
||||
return $organization->billable_rate;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getBillableRateForTimeEntry(TimeEntry $timeEntry): ?int
|
||||
{
|
||||
if (! $timeEntry->billable) {
|
||||
|
||||
Reference in New Issue
Block a user