Skip to content

Commit

Permalink
Feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
mxm1070 committed Feb 1, 2024
1 parent 8df8485 commit 49125be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ enum SlaComplianceStatus implements HasColor, HasIcon, HasLabel

case NonCompliant;

case NoResponse;

public function getLabel(): ?string
{
return match ($this) {
self::Compliant => 'Within SLA',
self::NonCompliant => 'Outside of SLA',
self::NoResponse => 'No Response',
};
}

Expand All @@ -62,7 +59,6 @@ public function getColor(): string | array | null
return match ($this) {
self::Compliant => 'success',
self::NonCompliant => 'danger',
self::NoResponse => 'warning',
};
}

Expand All @@ -71,7 +67,6 @@ public function getIcon(): string | null
return match ($this) {
self::Compliant => 'heroicon-m-check-circle',
self::NonCompliant => 'heroicon-m-x-circle',
self::NoResponse => 'heroicon-m-exclamation-circle'
};
}
}
11 changes: 2 additions & 9 deletions app-modules/service-management/src/Models/ServiceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,10 @@ public function latestOutboundServiceRequestUpdate(): HasOne
});
}

public function getLatestResponseSeconds(): ?int
public function getLatestResponseSeconds(): int
{
if (! $this->latestInboundServiceRequestUpdate) {
return null;
// return $this->created_at->diffInSeconds(now());
return $this->created_at->diffInSeconds(now());
}

if (
Expand Down Expand Up @@ -332,12 +331,6 @@ public function getResponseSlaComplianceStatus(): ?SlaComplianceStatus

$latestResponseSeconds = $this->getLatestResponseSeconds();

if (is_null($latestResponseSeconds)) {
return $this->created_at->diffInSeconds(now()) <= $slaResponseSeconds
? SlaComplianceStatus::NoResponse
: SlaComplianceStatus::NonCompliant;
}

return $latestResponseSeconds <= $slaResponseSeconds
? SlaComplianceStatus::Compliant
: SlaComplianceStatus::NonCompliant;
Expand Down

0 comments on commit 49125be

Please sign in to comment.