Compare commits

..

2 Commits

Author SHA1 Message Date
BuildTools
3e107950fe Referenzierungsfehler behoben 2024-09-05 20:16:40 +02:00
BuildTools
e0649f503f Fertige Quizze werden jetzt mit "Ergebnisse anzeigen" statt "Fortsetzen" angezeigt 2024-09-05 20:16:23 +02:00
2 changed files with 43 additions and 29 deletions

View File

@ -11,9 +11,21 @@
@if (CurrentSession.LoadGame != null) @if (CurrentSession.LoadGame != null)
{ {
<h1>Vorherigen Lauf fortsetzen</h1> <h1>Vorheriges Quiz</h1>
<div>@CurrentSession.LoadGame.Title</div> <div>@CurrentSession.LoadGame.Title</div>
<button class="btn btn-primary" type="button" @onclick="() => StartQuiz(CurrentSession.LoadGame)">Fortsetzen</button>
@if (CurrentSession.LoadGame.Questions?.Count == 0 && CurrentSession.LoadGame.QuestionAnswers != null)
{
<button class="btn btn-primary" type="button" @onclick="() => StartQuiz(CurrentSession.LoadGame)">
Ergebnisse ansehen</button>
}
else
{
<button class="btn btn-primary" type="button" @onclick="() => StartQuiz(CurrentSession.LoadGame)">
Fortsetzen
</button>
}
<button class="btn btn-outline-danger" type="button" @onclick="DeleteGameState">Löschen</button> <button class="btn btn-outline-danger" type="button" @onclick="DeleteGameState">Löschen</button>
} }
@ -34,13 +46,13 @@
<Body> <Body>
@if (SelectedQuiz != null && NewGame != null) @if (SelectedQuiz != null && NewGame != null)
{ {
@* <div class="mb-3"> @* <div class="mb-3">
<label for="btngrpMode" class="form-label">Modus</label> <label for="btngrpMode" class="form-label">Modus</label>
<div class="btn-group form-control" id="btngrpMode"> <div class="btn-group form-control" id="btngrpMode">
<a href="#" @onclick="() => NewGame.Mode = GameState.QuizMode.Practice" class="btn @(NewGame.Mode == GameState.QuizMode.Practice ? "btn-primary active" : "btn-outline-primary")">Üben</a> <a href="#" @onclick="() => NewGame.Mode = GameState.QuizMode.Practice" class="btn @(NewGame.Mode == GameState.QuizMode.Practice ? "btn-primary active" : "btn-outline-primary")">Üben</a>
<a href="#" @onclick="() => NewGame.Mode = GameState.QuizMode.Tournament" class="btn @(NewGame.Mode == GameState.QuizMode.Tournament ? "btn-primary active" : "btn-outline-primary")">Rangliste</a> <a href="#" @onclick="() => NewGame.Mode = GameState.QuizMode.Tournament" class="btn @(NewGame.Mode == GameState.QuizMode.Tournament ? "btn-primary active" : "btn-outline-primary")">Rangliste</a>
</div> </div>
</div> *@ </div> *@
<div class="mb-3"> <div class="mb-3">
<label for="cboQuestionGroup" class="form-label">Fragenkatalog</label> <label for="cboQuestionGroup" class="form-label">Fragenkatalog</label>
@ -57,10 +69,10 @@
<input type="range" min="1" max="@QuestionCountMax" @bind="@QuestionCountValue" class="form-range" id="rngQuestionCount"> <input type="range" min="1" max="@QuestionCountMax" @bind="@QuestionCountValue" class="form-range" id="rngQuestionCount">
</div> </div>
@* <div class="mb-3"> @* <div class="mb-3">
<label for="txtName" class="form-label">Name</label> <label for="txtName" class="form-label">Name</label>
<input @bind="NewGame.Username" class="form-control" type="text" placeholder="(optional)" id="txtName" /> <input @bind="NewGame.Username" class="form-control" type="text" placeholder="(optional)" id="txtName" />
</div> *@ </div> *@
} }
</Body> </Body>
<Footer> <Footer>

View File

@ -58,18 +58,18 @@ else
<table class="table"> <table class="table">
<tbody> <tbody>
<tr class="table-primary"> <tr class="table-primary">
<td>Fragen Gesamt</td> <td>Fragen Gesamt</td>
<td>@(CurrentSession.LoadGame.QuestionAnswers.Count)</td> <td>@(CurrentSession.LoadGame.QuestionAnswers.Count)</td>
</tr> </tr>
<tr class="table-success"> <tr class="table-success">
<td>Korrekt beantwortet</td> <td>Korrekt beantwortet</td>
<td>@(CurrentSession.LoadGame.QuestionAnswers.Where(qa => qa.IsCorrect).Count())</td> <td>@(CurrentSession.LoadGame.QuestionAnswers.Where(qa => qa.IsCorrect).Count())</td>
</tr> </tr>
<tr class="table-danger"> <tr class="table-danger">
<td>Falsch beantwortet</td> <td>Falsch beantwortet</td>
<td>@(CurrentSession.LoadGame.QuestionAnswers.Where(qa => !qa.IsCorrect).Count())</td> <td>@(CurrentSession.LoadGame.QuestionAnswers.Where(qa => !qa.IsCorrect).Count())</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -126,11 +126,13 @@ else
if (CurrentSession.LoadGame.QuestionAnswers == null) CurrentSession.LoadGame.QuestionAnswers = new(); if (CurrentSession.LoadGame.QuestionAnswers == null) CurrentSession.LoadGame.QuestionAnswers = new();
if (CurrentSession.LoadGame.CurrentQuestion != null) if (CurrentSession.LoadGame.CurrentQuestion != null)
{ {
CurrentSession.LoadGame.QuestionAnswers.Add(new(CurrentSession.LoadGame.CurrentQuestion) CurrentSession.LoadGame.QuestionAnswers.Add(new(CurrentSession.LoadGame.CurrentQuestion));
{ foreach (Answer aw in SelectedAnswers)
GivenAnswers = SelectedAnswers, {
}); CurrentSession.LoadGame.QuestionAnswers[^1].GivenAnswers.Add(aw);
}
} }
SelectedAnswers.Clear(); SelectedAnswers.Clear();
CurrentSession.LoadGame.NextQuestion(); CurrentSession.LoadGame.NextQuestion();
await CurrentSession.SaveAsync(); await CurrentSession.SaveAsync();