This commit is contained in:
parent
e4d0ac9072
commit
3d67eedf0c
@ -49,9 +49,8 @@ class PlayerController extends Controller
|
|||||||
try {
|
try {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
$section_id = $watch_history->current_section_id;
|
$watching_id = $lesson_id ?: $watch_history->current_watching_id;
|
||||||
$watching_id = $lesson_id ?? $watch_history->current_watching_id;
|
$watching_type = in_array($type, ['lesson', 'quiz'], true) ? $type : ($watch_history->current_watching_type ?? 'lesson');
|
||||||
$watching_type = $watch_history->current_watching_type ?? $type;
|
|
||||||
|
|
||||||
$course = $this->courseService->getUserCourseById($watch_history->course_id, $user);
|
$course = $this->courseService->getUserCourseById($watch_history->course_id, $user);
|
||||||
$watching = $this->coursePlay->getWatchingLesson($watching_id, $watching_type);
|
$watching = $this->coursePlay->getWatchingLesson($watching_id, $watching_type);
|
||||||
@ -60,18 +59,14 @@ class PlayerController extends Controller
|
|||||||
$totalReviews = $this->reviewService->totalReviews($course->id);
|
$totalReviews = $this->reviewService->totalReviews($course->id);
|
||||||
$zoomConfig = $this->zoomLiveService->zoomConfig;
|
$zoomConfig = $this->zoomLiveService->zoomConfig;
|
||||||
|
|
||||||
$section = null;
|
|
||||||
$totalContent = 0;
|
$totalContent = 0;
|
||||||
|
|
||||||
foreach ($course->sections as $courseSection) {
|
foreach ($course->sections as $courseSection) {
|
||||||
$totalContent += count($courseSection->section_lessons) + count($courseSection->section_quizzes);
|
$totalContent += count($courseSection->section_lessons) + count($courseSection->section_quizzes);
|
||||||
|
|
||||||
if ($courseSection->id == $section_id) {
|
|
||||||
$section = $courseSection;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$watchHistory = $this->coursePlay->watchHistory($course, $watching_id, $watching_type, $user->id);
|
$watchHistory = $this->coursePlay->watchHistory($course, $watching_id, $watching_type, $user->id);
|
||||||
|
$section = $course->sections->firstWhere('id', $watchHistory->current_section_id);
|
||||||
|
|
||||||
// $submissions = null;
|
// $submissions = null;
|
||||||
// if ($assignment) {
|
// if ($assignment) {
|
||||||
@ -91,6 +86,28 @@ class PlayerController extends Controller
|
|||||||
'zoomConfig' => $zoomConfig,
|
'zoomConfig' => $zoomConfig,
|
||||||
]);
|
]);
|
||||||
} catch (ModelNotFoundException $th) {
|
} catch (ModelNotFoundException $th) {
|
||||||
|
$fallbackId = $watch_history->current_watching_id;
|
||||||
|
$fallbackType = $watch_history->current_watching_type;
|
||||||
|
$requestedType = $watching_type ?? $type;
|
||||||
|
|
||||||
|
if ($fallbackId && in_array($fallbackType, ['lesson', 'quiz'], true)) {
|
||||||
|
$isDifferentFromRequested = ((string) $fallbackId !== (string) $lesson_id) || ($fallbackType !== $requestedType);
|
||||||
|
|
||||||
|
if ($isDifferentFromRequested) {
|
||||||
|
try {
|
||||||
|
$this->coursePlay->getWatchingLesson((string) $fallbackId, $fallbackType);
|
||||||
|
|
||||||
|
return redirect()->route('course.player', [
|
||||||
|
'type' => $fallbackType,
|
||||||
|
'watch_history' => $watch_history->id,
|
||||||
|
'lesson_id' => $fallbackId,
|
||||||
|
]);
|
||||||
|
} catch (ModelNotFoundException $fallbackException) {
|
||||||
|
// Fall through to generic error below.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route('category.courses', ['category' => 'all'])->with('error', 'The requested content could not be found.');
|
return redirect()->route('category.courses', ['category' => 'all'])->with('error', 'The requested content could not be found.');
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
return redirect()->route('category.courses', ['category' => 'all'])->with('error', $th->getMessage());
|
return redirect()->route('category.courses', ['category' => 'all'])->with('error', $th->getMessage());
|
||||||
|
|||||||
2
resources/js/types/exam.d.ts
vendored
2
resources/js/types/exam.d.ts
vendored
@ -251,7 +251,7 @@ interface EnrollmentProgress {
|
|||||||
enrollment: ExamEnrollment;
|
enrollment: ExamEnrollment;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
attempts_used: number;
|
attempts_used: number;
|
||||||
attempts_remaining: number;
|
attempts_remaining: number | null;
|
||||||
completed_attempts: number;
|
completed_attempts: number;
|
||||||
best_score: number;
|
best_score: number;
|
||||||
has_passed: boolean;
|
has_passed: boolean;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user