-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create crosswordpicker and remote rendering for crosswords
- Loading branch information
1 parent
6ddcbf0
commit b642a4f
Showing
6 changed files
with
130 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
applications/app/services/dotcomrendering/CrosswordsPicker.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package services.dotcomrendering | ||
|
||
import common.GuLogging | ||
import crosswords.CrosswordPageWithContent | ||
import model.Cors.RichRequestHeader | ||
import play.api.mvc.RequestHeader | ||
import utils.DotcomponentsLogger | ||
|
||
object CrosswordsPicker extends GuLogging { | ||
|
||
/** | ||
* | ||
* Add to this function any logic for including/excluding | ||
* a crossword page from being rendered with DCR | ||
* | ||
* Currently defaulting to false until we implement crosswords in DCR | ||
* | ||
* */ | ||
private def dcrCouldRender(crosswordPageWithContent: CrosswordPageWithContent): Boolean = { | ||
false | ||
} | ||
|
||
def getTier( | ||
crosswordPageWithContent: CrosswordPageWithContent, | ||
)(implicit | ||
request: RequestHeader, | ||
): RenderType = { | ||
|
||
val participatingInTest = false // until we create a test for this content type | ||
val dcrCanRender = dcrCouldRender(crosswordPageWithContent) | ||
|
||
val tier = { | ||
if (request.forceDCROff) LocalRender | ||
else if (request.forceDCR) RemoteRender | ||
else if (dcrCanRender && participatingInTest) RemoteRender | ||
else LocalRender | ||
} | ||
|
||
if (tier == RemoteRender) { | ||
DotcomponentsLogger.logger.logRequest( | ||
s"path executing in dotcomponents", | ||
Map.empty, | ||
crosswordPageWithContent.item, | ||
) | ||
} else { | ||
DotcomponentsLogger.logger.logRequest(s"path executing in web", Map.empty, crosswordPageWithContent.item) | ||
} | ||
|
||
tier | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters