Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ public final Response getGameboard(@Context final Request request,

try {
GameboardDTO gameboard;
boolean isLinked = false;

AbstractSegueUserDTO randomUser = this.userManager.getCurrentUser(httpServletRequest);

Expand All @@ -251,18 +252,23 @@ public final Response getGameboard(@Context final Request request,
} else {
List<String> gameboardPageIds = unAugmentedGameboard.getContents().stream().map(GameboardItem::getId).collect(Collectors.toList());
userQuestionAttempts = this.questionManager.getMatchingLightweightQuestionAttempts((RegisteredUserDTO) randomUser, gameboardPageIds);
isLinked = gameManager.isBoardLinkedToUser((RegisteredUserDTO) randomUser, unAugmentedGameboard.getId());
}

// Calculate the ETag
EntityTag etag = new EntityTag(unAugmentedGameboard.toString().hashCode()
+ userQuestionAttempts.toString().hashCode() + "");
+ userQuestionAttempts.toString().hashCode()
+ Boolean.hashCode(isLinked)
+ ""
);

Response cachedResponse = generateCachedResponse(request, etag, NEVER_CACHE_WITHOUT_ETAG_CHECK);
if (cachedResponse != null) {
return cachedResponse;
}

// attempt to augment the gameboard with user information.
// FIXME isBoardLinkedToUser gets called a second time here
gameboard = gameManager.getGameboard(gameboardId, randomUser, userQuestionAttempts);

// We decided not to log this on the backend as the front end uses this lots.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ private static List<Content> depthFirstDOQuestionSearch(final Content c, final L
* @throws SegueDatabaseException
* if there is a database error
*/
private boolean isBoardLinkedToUser(final RegisteredUserDTO user, final String gameboardId)
public boolean isBoardLinkedToUser(final RegisteredUserDTO user, final String gameboardId)
throws SegueDatabaseException {
Set<String> linkedIds = this.gameboardPersistenceManager
.getGameboardIdsLinkedToUser(user.getId(), Collections.singleton(gameboardId));
Expand Down
Loading