Skip to content

Commit

Permalink
Fix detection of listening challenges
Browse files Browse the repository at this point in the history
  • Loading branch information
blmage committed Oct 26, 2024
1 parent 21b7842 commit e70a7c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/mv2/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ const handleCurrentListeningChallengeRequest = async (senderId, data, sendResult

if (isString(data.solutionTranslation) && ('' !== data.solutionTranslation)) {
const solutionTranslation = normalizeString(data.solutionTranslation);
predicate = solutionTranslation === it.solutionTranslation;

predicate = challenge => (
solutionTranslation.startsWith(challenge.solutionTranslation)
|| solutionTranslation.endsWith(challenge.solutionTranslation)
);
}

challenges = findSessionChallengesOfType(senderId, CHALLENGE_TYPE_LISTENING, predicate);
Expand Down
6 changes: 5 additions & 1 deletion src/mv3/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ const handleCurrentListeningChallengeRequest = async (senderId, data, sendResult

if (isString(data.solutionTranslation) && ('' !== data.solutionTranslation)) {
const solutionTranslation = normalizeString(data.solutionTranslation);
predicate = solutionTranslation === it.solutionTranslation;

predicate = challenge => (
solutionTranslation.startsWith(challenge.solutionTranslation)
|| solutionTranslation.endsWith(challenge.solutionTranslation)
);
}

challenges = await findSessionChallengesOfType(senderId, CHALLENGE_TYPE_LISTENING, predicate);
Expand Down

0 comments on commit e70a7c2

Please sign in to comment.