mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
69 lines
1.7 KiB
Plaintext
69 lines
1.7 KiB
Plaintext
@using Management.Web.Shared.Components
|
|
@using Management.Web.Shared.Components.Forms
|
|
|
|
@inject QuizEditorContext quizContext
|
|
@inject CoursePlanner planner
|
|
|
|
@code {
|
|
protected override void OnInitialized()
|
|
{
|
|
quizContext.StateHasChanged += reload;
|
|
}
|
|
private void reload()
|
|
{
|
|
if (quizContext.Quiz != null)
|
|
{
|
|
if (lockAt == null)
|
|
lockAt = quizContext.Quiz.LockAt;
|
|
if (!shuffleAnswers)
|
|
shuffleAnswers = quizContext.Quiz.ShuffleAnswers;
|
|
if (!oneQuestionAtATime)
|
|
oneQuestionAtATime = quizContext.Quiz.OneQuestionAtATime;
|
|
if (allowedAttempts == 0)
|
|
allowedAttempts = quizContext.Quiz.AllowedAttempts;
|
|
|
|
this.InvokeAsync(this.StateHasChanged);
|
|
}
|
|
}
|
|
public void Dispose()
|
|
{
|
|
quizContext.StateHasChanged -= reload;
|
|
}
|
|
|
|
private DateTime? lockAt { get; set; }
|
|
private bool shuffleAnswers { get; set; }
|
|
private bool oneQuestionAtATime { get; set; }
|
|
private int allowedAttempts { get; set; }
|
|
|
|
private void setAssignmentGroup(LocalAssignmentGroup? group)
|
|
{
|
|
if(quizContext.Quiz == null)
|
|
return;
|
|
|
|
var newQuiz = quizContext.Quiz with
|
|
{
|
|
LocalAssignmentGroupName = group?.Name
|
|
};
|
|
|
|
quizContext.SaveQuiz(newQuiz);
|
|
}
|
|
|
|
private LocalAssignmentGroup? selectedAssignmentGroup =>
|
|
planner
|
|
.LocalCourse?
|
|
.Settings
|
|
.AssignmentGroups
|
|
.FirstOrDefault(g => g.Name == quizContext.Quiz?.LocalAssignmentGroupName);
|
|
}
|
|
@if(planner.LocalCourse != null )
|
|
{
|
|
<div>
|
|
<ButtonSelect
|
|
Label="Assignment Group"
|
|
Options="planner.LocalCourse.Settings.AssignmentGroups"
|
|
GetName="(g) => g?.Name"
|
|
OnSelect="(g) => setAssignmentGroup(g)"
|
|
SelectedOption="selectedAssignmentGroup"
|
|
/>
|
|
</div>
|
|
} |