mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
added points to quiz editor
This commit is contained in:
@@ -32,8 +32,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
<div class="modal @modalClass" @onclick="Hide">
|
||||
<div class="modal-dialog modal-xl" role="document" @onclick:stopPropagation="true">
|
||||
<div class="modal @modalClass" @onmousedown="Hide">
|
||||
<div class="modal-dialog modal-xl" role="document" @onmousedown:stopPropagation="true">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title text-center w-100">@Title</h4>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using Management.Web.Shared.Components
|
||||
|
||||
@inject QuizEditorContext quizContext
|
||||
|
||||
@code {
|
||||
@@ -100,12 +101,18 @@
|
||||
quizContext.SaveQuiz(newQuiz);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<Modal @ref="modal" OnHide="() => quizContext.Quiz = null" >
|
||||
<Title>
|
||||
@quizContext.Quiz?.Name
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-auto">
|
||||
@quizContext.Quiz?.Name
|
||||
</div>
|
||||
<div class="col-auto me-3">
|
||||
Points: @quizContext.Quiz?.Questions.Sum(q => q.Points)
|
||||
</div>
|
||||
</div>
|
||||
</Title>
|
||||
<Body>
|
||||
@if(quizContext.Quiz != null)
|
||||
|
||||
@@ -15,11 +15,14 @@
|
||||
|
||||
if(answers.Count() == 0)
|
||||
answers = Question.Answers;
|
||||
if (points == 0)
|
||||
points = Question.Points;
|
||||
|
||||
base.OnParametersSet();
|
||||
}
|
||||
private string text { get; set; } = string.Empty;
|
||||
private string questionType { get; set; } = string.Empty;
|
||||
private int points { get; set; }
|
||||
private IEnumerable<LocalQuizQuestionAnswer> answers { get; set; } = Enumerable.Empty<LocalQuizQuestionAnswer>();
|
||||
|
||||
private void handleTypeUpdate(string type)
|
||||
@@ -35,6 +38,18 @@
|
||||
UpdateQuestion(newQuestion);
|
||||
}
|
||||
}
|
||||
private void handlePointsInput(ChangeEventArgs e)
|
||||
{
|
||||
if (quizContext.Quiz != null)
|
||||
{
|
||||
var newPoints = int.Parse(e.Value?.ToString() ?? "0");
|
||||
var newQuestion = Question with
|
||||
{
|
||||
Points = newPoints
|
||||
};
|
||||
UpdateQuestion(newQuestion);
|
||||
}
|
||||
}
|
||||
|
||||
private void addAnswer()
|
||||
{
|
||||
@@ -130,6 +145,23 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<div class="col-auto">
|
||||
<label
|
||||
for="exampleInputEmail1"
|
||||
class="form-label"
|
||||
>
|
||||
Points
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
class="form-control"
|
||||
id="exampleInputEmail1"
|
||||
@bind="points"
|
||||
@oninput="handlePointsInput"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div>Answers:</div>
|
||||
|
||||
@if(questionType == QuestionType.MULTIPLE_ANSWERS || questionType == QuestionType.MULTIPLE_CHOICE)
|
||||
|
||||
Reference in New Issue
Block a user