Fix Rating

This commit is contained in:
R
2022-09-23 09:35:39 +07:00
parent 5fe1dc4bc6
commit bae91e6120
5 changed files with 49 additions and 19 deletions

View File

@@ -52,7 +52,7 @@ class DoctorResource extends JsonResource
'keilmuan' => $this->meta->keilmuan ?? '',
'description' => $this->meta->description ?? '',
'practices' => $practices,
'rating' => rand(350, 500) / 10,
'rating' => rand(350, 500) / 100,
];
}
}

View File

@@ -24,7 +24,7 @@ class HospitalResource extends JsonResource
'lng' => $this->currentAddress->lng ?? null,
'distance' => isset($this->distance_km) ? round($this->distance_km) . ' km' : null,
'city_name' => $this->currentAddress->city->name ?? null,
'rating' => rand(350, 500) / 10,
'rating' => rand(350, 500) / 100,
'phone' => $this->meta->phone,
'photo_url' => asset('images/default-hospital-image.png'),
'photos' => [

View File

@@ -35,7 +35,7 @@ class PractitionerRoleToDoctorDetailResource extends JsonResource
'work_experience' => $this->meta->work_experience ?? '',
'keilmuan' => $this->meta->keilmuan ?? '',
'description' => $this->meta->description ?? '',
'rating' => rand(350, 500) / 10,
'rating' => rand(350, 500) / 100,
'is_chat_available' => $this->is_chat_available,
'is_video_available' => $this->is_video_available,

View File

@@ -15,17 +15,18 @@ class PractitionerRoleToDoctorResource extends JsonResource
*/
public function toArray($request)
{
$organization = [
'id' => $this->organization->id,
'name' => $this->organization->name,
'code' => $this->organization->code,
'description' => $this->organization->description,
'address' => $this->organization->currentAddress->text ?? null,
'lat' => $this->organization->currentAddress->lat ?? null,
'lng' => $this->organization->currentAddress->lng ?? null,
'distance' => '200 m',
'city_name' => 'Kota Tangerang',
];
// $organization = [
// 'id' => $this->organization->id,
// 'name' => $this->organization->name,
// 'code' => $this->organization->code,
// 'description' => $this->organization->description,
// 'address' => $this->organization->currentAddress->text ?? null,
// 'lat' => $this->organization->currentAddress->lat ?? null,
// 'lng' => $this->organization->currentAddress->lng ?? null,
// 'distance' => '200 m',
// 'city_name' => 'Kota Tangerang',
// ];
$organization = HospitalResource::make($this->organization);
$speciality = $this->speciality ? [
'id' => $this->speciality->id ?? null,
@@ -51,7 +52,7 @@ class PractitionerRoleToDoctorResource extends JsonResource
'avatar_url' => asset('images/default-doctor-avatar.png'),
'hospital' => $organization,
'speciality' => $speciality,
'rating' => rand(350, 500) / 10,
'rating' => rand(350, 500) / 100,
'is_chat_available' => $this->is_chat_available,
'is_video_available' => $this->is_video_available,