Fix initializeMembers
This commit is contained in:
parent
5776c6c8fb
commit
63273015c7
|
@ -74,35 +74,43 @@ class InitializeMembers {
|
||||||
'version' => $member->version,
|
'version' => $member->version,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($this->api->coursesFor($member->id) as $course) {
|
try {
|
||||||
$m->courses()->create([
|
foreach ($this->api->coursesFor($member->id) as $course) {
|
||||||
'course_id' => Course::where('nami_id', $course->course_id)->firstOrFail()->id,
|
$m->courses()->create([
|
||||||
'organizer' => $course->organizer,
|
'course_id' => Course::where('nami_id', $course->course_id)->firstOrFail()->id,
|
||||||
'event_name' => $course->event_name,
|
'organizer' => $course->organizer,
|
||||||
'completed_at' => $course->completed_at,
|
'event_name' => $course->event_name,
|
||||||
'nami_id' => $course->id,
|
'completed_at' => $course->completed_at,
|
||||||
]);
|
'nami_id' => $course->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
} catch (RightException $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->api->membershipsOf($member->id) as $membership) {
|
try {
|
||||||
if ($membership['entries_aktivBis'] !== '') {
|
foreach ($this->api->membershipsOf($member->id) as $membership) {
|
||||||
continue;
|
if ($membership['entries_aktivBis'] !== '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
[$activityId, $subactivityId, $groupId] = $this->fetchMembership($member, $membership);
|
||||||
|
} catch (RightException $e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (is_null($activityId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$m->memberships()->create([
|
||||||
|
'nami_id' => $membership['id'],
|
||||||
|
'from' => $membership['entries_aktivVon'],
|
||||||
|
'group_id' => $groupId,
|
||||||
|
'activity_id' => $activityId,
|
||||||
|
'subactivity_id' => $subactivityId,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
try {
|
} catch (RightException $e) {
|
||||||
[$activityId, $subactivityId, $groupId] = $this->fetchMembership($member, $membership);
|
|
||||||
} catch (RightException $e) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (is_null($activityId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$m->memberships()->create([
|
|
||||||
'nami_id' => $membership['id'],
|
|
||||||
'from' => $membership['entries_aktivVon'],
|
|
||||||
'group_id' => $groupId,
|
|
||||||
'activity_id' => $activityId,
|
|
||||||
'subactivity_id' => $subactivityId,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
} catch (ModelNotFoundException $e) {
|
} catch (ModelNotFoundException $e) {
|
||||||
dd($e->getMessage(), $member);
|
dd($e->getMessage(), $member);
|
||||||
|
|
Loading…
Reference in New Issue