mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 15:18:32 -06:00
updates to markdown for essay questions
This commit is contained in:
@@ -317,4 +317,60 @@ short answer
|
||||
firstQuestion.QuestionType.Should().Be(QuestionType.SHORT_ANSWER);
|
||||
firstQuestion.Text.Should().NotContain("short answer");
|
||||
}
|
||||
[Test]
|
||||
public void ShortAnswerToMarkdown_IsCorrect()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
multi line
|
||||
description
|
||||
---
|
||||
Which events are triggered when the user clicks on an input field?
|
||||
short answer
|
||||
";
|
||||
|
||||
var quiz = LocalQuiz.ParseMarkdown(rawMarkdownQuiz);
|
||||
var firstQuestion = quiz.Questions.First();
|
||||
|
||||
var questionMarkdown = firstQuestion.ToMarkdown();
|
||||
var expectedMarkdown = @"Points: 1
|
||||
Which events are triggered when the user clicks on an input field?
|
||||
short_answer";
|
||||
questionMarkdown.Should().Contain(expectedMarkdown);
|
||||
}
|
||||
[Test]
|
||||
public void EssayQuestionToMarkdown_IsCorrect()
|
||||
{
|
||||
var rawMarkdownQuiz = @"
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
multi line
|
||||
description
|
||||
---
|
||||
Which events are triggered when the user clicks on an input field?
|
||||
essay
|
||||
";
|
||||
|
||||
var quiz = LocalQuiz.ParseMarkdown(rawMarkdownQuiz);
|
||||
var firstQuestion = quiz.Questions.First();
|
||||
|
||||
var questionMarkdown = firstQuestion.ToMarkdown();
|
||||
var expectedMarkdown = @"Points: 1
|
||||
Which events are triggered when the user clicks on an input field?
|
||||
essay";
|
||||
questionMarkdown.Should().Contain(expectedMarkdown);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,18 @@
|
||||
private bool loading { get; set; }= true;
|
||||
private bool addingQuizToCanvas = false;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
quizContext.StateHasChanged += reload;
|
||||
}
|
||||
private void reload()
|
||||
{
|
||||
this.InvokeAsync(this.StateHasChanged);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
quizContext.StateHasChanged -= reload;
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if(loading)
|
||||
@@ -87,12 +99,22 @@
|
||||
private CanvasQuiz? quizInCanvas => planner.CanvasQuizzes?.FirstOrDefault(q => q.Title == quizContext.Quiz?.Name);
|
||||
|
||||
private string canvasQuizUrl => $"https://snow.instructure.com/courses/{planner.LocalCourse?.Settings.CanvasId}/quizzes/{quizInCanvas?.Id}";
|
||||
|
||||
private int? quizPoints => quizContext.Quiz?.Questions.Sum(q => q.Points);
|
||||
}
|
||||
|
||||
<div class="d-flex flex-column py-3" style="height: 100vh;">
|
||||
|
||||
<section>
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-auto my-auto">
|
||||
<button
|
||||
class="btn btn-outline-secondary"
|
||||
@onclick="done"
|
||||
>
|
||||
← go back
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-auto my-auto">
|
||||
<h2>
|
||||
@quizContext.Quiz?.Name
|
||||
@@ -107,7 +129,7 @@
|
||||
}
|
||||
<div class="col-auto me-3">
|
||||
<h3>
|
||||
Points: @quizContext.Quiz?.Questions.Sum(q => q.Points)
|
||||
Points: @quizPoints
|
||||
</h3>
|
||||
@if(quizInCanvas != null)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
[Parameter, EditorRequired]
|
||||
public Action<T?> OnSelect { get; set; } = default!;
|
||||
|
||||
[Parameter, EditorRequired]
|
||||
[Parameter]
|
||||
public T? SelectedOption { get; set; }
|
||||
|
||||
private string htmlLabel => Label.Replace("-", "");
|
||||
|
||||
@@ -84,12 +84,15 @@ essay
|
||||
---
|
||||
points: 4
|
||||
this is a short answer question
|
||||
short_answer";
|
||||
short_answer
|
||||
---
|
||||
points: 4
|
||||
the underscore is optional
|
||||
short answer";
|
||||
|
||||
}
|
||||
|
||||
<div class="d-flex flex-column h-100">
|
||||
|
||||
<div class="d-flex flex-row flex-grow-1">
|
||||
@if(showHelp)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using Management.Web.Shared.Components
|
||||
@using Management.Web.Shared.Components.Forms
|
||||
|
||||
@inject CoursePlanner planner
|
||||
@code {
|
||||
@@ -16,10 +17,18 @@
|
||||
private void submitHandler()
|
||||
{
|
||||
Console.WriteLine("new quiz");
|
||||
Console.WriteLine(selectedAssignmentGroup);
|
||||
if(Name.Trim() == string.Empty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var newQuiz = new LocalQuiz
|
||||
{
|
||||
Name=Name,
|
||||
Description = "",
|
||||
LocalAssignmentGroupName = selectedAssignmentGroup?.Name,
|
||||
};
|
||||
if(planner.LocalCourse != null)
|
||||
{
|
||||
@@ -38,6 +47,13 @@
|
||||
}
|
||||
modal?.Hide();
|
||||
}
|
||||
|
||||
|
||||
private void setAssignmentGroup(LocalAssignmentGroup? group)
|
||||
{
|
||||
selectedAssignmentGroup = group;
|
||||
}
|
||||
private LocalAssignmentGroup? selectedAssignmentGroup { get; set; }
|
||||
}
|
||||
|
||||
<button
|
||||
@@ -53,7 +69,15 @@
|
||||
<form @onsubmit:preventDefault="true" @onsubmit="submitHandler">
|
||||
<label for="Assignment Name">Name</label>
|
||||
<input id="moduleName" class="form-control" @bind="Name" />
|
||||
<br>
|
||||
<label class="form-label">Assignment Group</label>
|
||||
</form>
|
||||
<ButtonSelect
|
||||
Label="Assignment Group"
|
||||
Options="planner.LocalCourse.Settings.AssignmentGroups"
|
||||
GetName="(g) => g?.Name"
|
||||
OnSelect="(g) => setAssignmentGroup(g)"
|
||||
/>
|
||||
</Body>
|
||||
<Footer>
|
||||
<button
|
||||
|
||||
@@ -34,8 +34,7 @@ public record LocalQuizQuestion
|
||||
|
||||
return $@"Points: {Points}
|
||||
{Text}
|
||||
{answersText}
|
||||
{questionTypeIndicator}";
|
||||
{answersText}{questionTypeIndicator}";
|
||||
}
|
||||
|
||||
private static readonly string[] validFirstAnswerDelimiters = new string[] { "*a)", "a)", "[ ]", "[*]" };
|
||||
|
||||
@@ -17,5 +17,3 @@ Apparently the VSCode razor extension was compiled with a preview of dotnet 6...
|
||||
|
||||
The issue can be tracked [here](https://github.com/dotnet/razor/issues/6241)
|
||||
|
||||
|
||||
I am looking for a TA and grader for my CS 1410/1415 class. The labs are tuesdays at 7:30 - 9:30 am. Anyone who is interested, please message me on teams or send an email to alex.mickelson@snow.edu.
|
||||
Reference in New Issue
Block a user