-
Notifications
You must be signed in to change notification settings - Fork 0
Add Translation Quiz game mode, winning streak, high score, timer expiry reveal, and Playwright E2E tests #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
HannoZ
merged 8 commits into
feature/game-update
from
copilot/start-implementation-cloud
Apr 30, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b18a7c9
Initial plan
Copilot 570ac7e
Implement Translation Quiz mode, winning streak, high score, and time…
Copilot 7e4414a
Address review feedback: add ExpireRoundAsync endpoint, extract Build…
Copilot 661c478
Merge feature/game-update: incorporate rich Sense Sprint features as …
Copilot 9028797
Merge feature/game-update and rebased Translation Quiz onto it
Copilot d9c472d
Use all available languages from API instead of hardcoded list in Tra…
Copilot 833283c
Fix all pending review comments and add 13 Playwright E2E tests for T…
Copilot d55dc1b
Increase web server timeout to 120 seconds in Playwright configuration
HannoZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
source/Demo/Lexicala.NET.Demo.Api/Game/GameServiceHelpers.cs
This file contains hidden or 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,22 @@ | ||
| using Lexicala.NET.Response; | ||
|
|
||
| namespace Lexicala.NET.Demo.Api.Game; | ||
|
|
||
| internal static class GameServiceHelpers | ||
| { | ||
| internal static RateLimitDebugResponse? BuildRateLimit(ResponseMetadata? metadata) | ||
| { | ||
| var limits = metadata?.RateLimits; | ||
| if (limits is null) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| if (limits.Limit < 0 || limits.LimitRemaining < 0 || limits.Reset < 0) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| return new RateLimitDebugResponse(limits.Limit, limits.LimitRemaining, limits.Reset); | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
source/Demo/Lexicala.NET.Demo.Api/Game/ITranslationQuizGameService.cs
This file contains hidden or 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,14 @@ | ||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Lexicala.NET.Demo.Api.Game; | ||
|
|
||
| public interface ITranslationQuizGameService | ||
| { | ||
| Task<CreateQuizRoundResponse> CreateRoundAsync(string? targetLanguage = null, CancellationToken cancellationToken = default); | ||
|
|
||
| Task<QuizAnswerResponse> SubmitAnswerAsync(Guid roundId, string choice, CancellationToken cancellationToken = default); | ||
|
|
||
| Task<QuizAnswerResponse> ExpireRoundAsync(Guid roundId, CancellationToken cancellationToken = default); | ||
| } |
This file contains hidden or 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
25 changes: 25 additions & 0 deletions
25
source/Demo/Lexicala.NET.Demo.Api/Game/TranslationQuizContracts.cs
This file contains hidden or 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,25 @@ | ||
| using System; | ||
|
|
||
| namespace Lexicala.NET.Demo.Api.Game; | ||
|
|
||
| public sealed record CreateQuizRoundResponse( | ||
| Guid RoundId, | ||
| string SourceWord, | ||
| string SourceLanguage, | ||
| string TargetLanguage, | ||
| string[] Choices, | ||
| DateTimeOffset ExpiresAtUtc, | ||
| int RoundSeconds, | ||
| RateLimitDebugResponse? RateLimit | ||
| ); | ||
|
|
||
| public sealed record QuizAnswerRequest(string Choice); | ||
|
|
||
| public sealed record QuizAnswerResponse( | ||
| Guid RoundId, | ||
| bool IsCorrect, | ||
| string RoundStatus, | ||
| int AwardedPoints, | ||
| string CorrectAnswer, | ||
| string? Message | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GiveUpAsyncnow throws whenround.IsCompleted. Since "give up" is a client action that can be retried (or auto-triggered on timer expiry), making it non-idempotent can surface as avoidable 400s (especially if the client calls it more than once). Consider returning a consistent response for already-completed rounds (e.g.,roundStatus: "completed"+correctAnswer) similar toTranslationQuizGameService, instead of throwing.