Skip to content

Commit

Permalink
fix: refactor to remove ternary operators
Browse files Browse the repository at this point in the history
  • Loading branch information
mattb-hippo committed Dec 19, 2024
1 parent 346e8c5 commit c9b655e
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ public PathwaysNavigationHelper(Content page)
switch (page.PageType)
{
case PageType.PathwaysOverviewPage:
string url = "/";
if (page.PathwaysModule?.ContentsPage != null)
{
url += page.PathwaysModule.ContentsPage.Id;
}
else
{
url += GetFirstSectionFirstPageId(page);
}

this._next = new NavigationLocation
{
Url = "/" + (page.PathwaysModule?.ContentsPage == null
? GetFirstSectionFirstPageId(page)
: page.PathwaysModule.ContentsPage.Id)
Url = url
};
break;

Expand Down Expand Up @@ -167,12 +175,20 @@ private void SetTrainingPagePreviousNavigation(int pageCounter, int sectionCount
{
// first page in first section, previous should navigate back to contents page
// or overview page if there is no contents page
string url = "/";
if (page.PathwaysModule?.ContentsPage != null)
{
url += page.PathwaysModule.ContentsPage.Id;
}
else
{
url += page.PathwaysModule.OverviewPage?.Id;
}

this._previous = new NavigationLocation
{
Name = "Previous",
Url = "/" + (page.PathwaysModule?.ContentsPage != null
? page.PathwaysModule.ContentsPage.Id
: page.PathwaysModule.OverviewPage?.Id)
Url = url
};
}
}
Expand Down

0 comments on commit c9b655e

Please sign in to comment.