fix(playback): isolate curriculum keys and prevent non-uploaded lessons from falling back to previous video
This commit is contained in:
@@ -224,12 +224,23 @@ class CurriculumService
|
||||
$dbTitle = (string)($dbl['title'] ?? '');
|
||||
|
||||
$matched = false;
|
||||
if ($currKey !== '' && ($currKey === $lessonFile || $currKeyNoExt === $lessonFileNoExt)) {
|
||||
$matched = true;
|
||||
} elseif ($currKeyNoExt !== '' && str_ends_with($currKeyNoExt, $lessonId)) {
|
||||
$matched = true;
|
||||
} elseif ($dbTitle !== '' && ($dbTitle === $lessonTitle || str_contains($lessonTitle, $dbTitle) || str_contains($dbTitle, $lessonTitle))) {
|
||||
$matched = true;
|
||||
if ($currKeyNoExt !== '' && $lessonFileNoExt !== '') {
|
||||
if ($currKeyNoExt === $lessonFileNoExt) {
|
||||
$matched = true;
|
||||
} elseif (str_contains($currKeyNoExt, '/') && (
|
||||
str_ends_with($lessonFileNoExt, '/' . ltrim($currKeyNoExt, '/')) ||
|
||||
str_ends_with($currKeyNoExt, '/' . ltrim($lessonFileNoExt, '/'))
|
||||
)) {
|
||||
$matched = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$matched && $dbTitle !== '' && $lessonTitle !== '') {
|
||||
$normDb = preg_replace('/[\s\p{P}]+/u', '', mb_strtolower($dbTitle));
|
||||
$normLes = preg_replace('/[\s\p{P}]+/u', '', mb_strtolower($lessonTitle));
|
||||
if ($normDb === $normLes && mb_strlen($normDb) > 8) {
|
||||
$matched = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($matched) {
|
||||
|
||||
Reference in New Issue
Block a user