mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -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.QuestionType.Should().Be(QuestionType.SHORT_ANSWER);
|
||||||
firstQuestion.Text.Should().NotContain("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 loading { get; set; }= true;
|
||||||
private bool addingQuizToCanvas = false;
|
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()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
if(loading)
|
if(loading)
|
||||||
@@ -87,12 +99,22 @@
|
|||||||
private CanvasQuiz? quizInCanvas => planner.CanvasQuizzes?.FirstOrDefault(q => q.Title == quizContext.Quiz?.Name);
|
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 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;">
|
<div class="d-flex flex-column py-3" style="height: 100vh;">
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<div class="row justify-content-between">
|
<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">
|
<div class="col-auto my-auto">
|
||||||
<h2>
|
<h2>
|
||||||
@quizContext.Quiz?.Name
|
@quizContext.Quiz?.Name
|
||||||
@@ -107,7 +129,7 @@
|
|||||||
}
|
}
|
||||||
<div class="col-auto me-3">
|
<div class="col-auto me-3">
|
||||||
<h3>
|
<h3>
|
||||||
Points: @quizContext.Quiz?.Questions.Sum(q => q.Points)
|
Points: @quizPoints
|
||||||
</h3>
|
</h3>
|
||||||
@if(quizInCanvas != null)
|
@if(quizInCanvas != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
[Parameter, EditorRequired]
|
[Parameter, EditorRequired]
|
||||||
public Action<T?> OnSelect { get; set; } = default!;
|
public Action<T?> OnSelect { get; set; } = default!;
|
||||||
|
|
||||||
[Parameter, EditorRequired]
|
[Parameter]
|
||||||
public T? SelectedOption { get; set; }
|
public T? SelectedOption { get; set; }
|
||||||
|
|
||||||
private string htmlLabel => Label.Replace("-", "");
|
private string htmlLabel => Label.Replace("-", "");
|
||||||
|
|||||||
@@ -84,12 +84,15 @@ essay
|
|||||||
---
|
---
|
||||||
points: 4
|
points: 4
|
||||||
this is a short answer question
|
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-column h-100">
|
||||||
|
|
||||||
<div class="d-flex flex-row flex-grow-1">
|
<div class="d-flex flex-row flex-grow-1">
|
||||||
@if(showHelp)
|
@if(showHelp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@using Management.Web.Shared.Components
|
@using Management.Web.Shared.Components
|
||||||
|
@using Management.Web.Shared.Components.Forms
|
||||||
|
|
||||||
@inject CoursePlanner planner
|
@inject CoursePlanner planner
|
||||||
@code {
|
@code {
|
||||||
@@ -16,10 +17,18 @@
|
|||||||
private void submitHandler()
|
private void submitHandler()
|
||||||
{
|
{
|
||||||
Console.WriteLine("new quiz");
|
Console.WriteLine("new quiz");
|
||||||
|
Console.WriteLine(selectedAssignmentGroup);
|
||||||
|
if(Name.Trim() == string.Empty)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var newQuiz = new LocalQuiz
|
var newQuiz = new LocalQuiz
|
||||||
{
|
{
|
||||||
Name=Name,
|
Name=Name,
|
||||||
Description = "",
|
Description = "",
|
||||||
|
LocalAssignmentGroupName = selectedAssignmentGroup?.Name,
|
||||||
};
|
};
|
||||||
if(planner.LocalCourse != null)
|
if(planner.LocalCourse != null)
|
||||||
{
|
{
|
||||||
@@ -38,6 +47,13 @@
|
|||||||
}
|
}
|
||||||
modal?.Hide();
|
modal?.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setAssignmentGroup(LocalAssignmentGroup? group)
|
||||||
|
{
|
||||||
|
selectedAssignmentGroup = group;
|
||||||
|
}
|
||||||
|
private LocalAssignmentGroup? selectedAssignmentGroup { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -53,7 +69,15 @@
|
|||||||
<form @onsubmit:preventDefault="true" @onsubmit="submitHandler">
|
<form @onsubmit:preventDefault="true" @onsubmit="submitHandler">
|
||||||
<label for="Assignment Name">Name</label>
|
<label for="Assignment Name">Name</label>
|
||||||
<input id="moduleName" class="form-control" @bind="Name" />
|
<input id="moduleName" class="form-control" @bind="Name" />
|
||||||
|
<br>
|
||||||
|
<label class="form-label">Assignment Group</label>
|
||||||
</form>
|
</form>
|
||||||
|
<ButtonSelect
|
||||||
|
Label="Assignment Group"
|
||||||
|
Options="planner.LocalCourse.Settings.AssignmentGroups"
|
||||||
|
GetName="(g) => g?.Name"
|
||||||
|
OnSelect="(g) => setAssignmentGroup(g)"
|
||||||
|
/>
|
||||||
</Body>
|
</Body>
|
||||||
<Footer>
|
<Footer>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ public record LocalQuizQuestion
|
|||||||
|
|
||||||
return $@"Points: {Points}
|
return $@"Points: {Points}
|
||||||
{Text}
|
{Text}
|
||||||
{answersText}
|
{answersText}{questionTypeIndicator}";
|
||||||
{questionTypeIndicator}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] validFirstAnswerDelimiters = new string[] { "*a)", "a)", "[ ]", "[*]" };
|
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)
|
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