Skip to content

Commit

Permalink
Merge pull request #1655 from serlo/change-isFirstPage-check
Browse files Browse the repository at this point in the history
change isFirstPage check
  • Loading branch information
hugotiburtino authored Jul 4, 2024
2 parents 1babf29 + 9d1d2c5 commit 5973328
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/db-migrations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serlo/db-migrations",
"version": "1.1.0-staging.3",
"version": "1.1.0-staging.4",
"private": true,
"license": "Apache-2.0",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ function replaceLinks(object: object, coursePages: CoursePage[]) {

if (regex.test(object.href)) {
const isFirstPage =
coursePages.find((page) => page.courseId === courseId)
?.coursePageId === coursePageId
coursePages
.filter((page) => page.courseId === courseId)
.sort((a, b) => a.coursePageId - b.coursePageId)[0]
.coursePageId === coursePageId
if (isFirstPage) {
object.href = `/${courseId}`
} else {
Expand Down

0 comments on commit 5973328

Please sign in to comment.