-
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.
Crossword picker and JSON route (#26843)
* route for DCR-JSON crossword data * move crossword classes * create crosswordpicker and remote rendering for crosswords --------- Co-authored-by: Alina Boghiu <[email protected]>
- Loading branch information
1 parent
1d827d0
commit 7a52965
Showing
10 changed files
with
178 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
2 changes: 1 addition & 1 deletion
2
.../crosswords/AccessibleCrosswordRows.scala → .../crosswords/AccessibleCrosswordRows.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
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
File renamed without changes.
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
Oops, something went wrong.