Fix: Fake course
This commit is contained in:
parent
4753cbef2e
commit
2b7aca9b0d
14
src/Api.php
14
src/Api.php
|
@ -209,13 +209,15 @@ class Api {
|
||||||
$url = self::$url."/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/flist";
|
$url = self::$url."/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/flist";
|
||||||
$response = $this->http()->get($url);
|
$response = $this->http()->get($url);
|
||||||
|
|
||||||
return collect($response->json()['data'])->map(function($course) {
|
return collect($response->json()['data'])->map(function($course) use ($memberId) {
|
||||||
|
$single = $this->http()->get(self::$url."/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/{$course['id']}")['data'];
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
'id' => $course['entries_id'],
|
'id' => $single['id'],
|
||||||
'organizer' => $course['entries_veranstalter'],
|
'organizer' => $single['veranstalter'],
|
||||||
'course_name' => $course['entries_baustein'],
|
'course_id' => $single['bausteinId'],
|
||||||
'event_name' => $course['entries_vstgName'],
|
'event_name' => $single['vstgName'],
|
||||||
'completed_at' => $course['entries_vstgTag'],
|
'completed_at' => $single['vstgTag'],
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,9 +241,18 @@ class FakeBackend {
|
||||||
return Http::response(json_encode([
|
return Http::response(json_encode([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'totalEntries' => count($member['courses'] ?? []),
|
'totalEntries' => count($member['courses'] ?? []),
|
||||||
'data' => collect($member['courses'] ?? [])
|
'data' => collect($member['courses'])->map(fn ($course) => ['id' => $course['id']]),
|
||||||
]) ?: '{}', 200);
|
]) ?: '{}', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($member['courses'] ?? [] as $course) {
|
||||||
|
if ($request->url() === "https://nami.dpsg.de/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$member['id']}/{$course['id']}") {
|
||||||
|
return Http::response(json_encode([
|
||||||
|
'success' => true,
|
||||||
|
'data' => $course,
|
||||||
|
]) ?: '{}', 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue