mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
before i get in a deeper hole
This commit is contained in:
1
Management.Gherkin/.gitignore
vendored
1
Management.Gherkin/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
*.feature.cs
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace Management.Gherkin.Drivers
|
|
||||||
{
|
|
||||||
public class Driver
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
Feature: Calculator
|
|
||||||

|
|
||||||
Simple calculator for adding **two** numbers
|
|
||||||
|
|
||||||
Link to a feature: [Calculator]($projectname$/Features/Calculator.feature)
|
|
||||||
***Further read***: **[Learn more about how to generate Living Documentation](https://docs.specflow.org/projects/specflow-livingdoc/en/latest/LivingDocGenerator/Generating-Documentation.html)**
|
|
||||||
|
|
||||||
@mytag
|
|
||||||
Scenario: Add two numbers
|
|
||||||
Given the first number is 50
|
|
||||||
And the second number is 70
|
|
||||||
When the two numbers are added
|
|
||||||
Then the result should be 120
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
using System;
|
|
||||||
using TechTalk.SpecFlow;
|
|
||||||
|
|
||||||
namespace Management.Gherkin.Hooks
|
|
||||||
{
|
|
||||||
[Binding]
|
|
||||||
public class Hooks
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
|
||||||
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.*" />
|
|
||||||
<PackageReference Include="SpecFlow.NUnit" Version="3.9.74" />
|
|
||||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
|
|
||||||
<PackageReference Include="FluentAssertions" Version="6.8.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
using TechTalk.SpecFlow;
|
|
||||||
|
|
||||||
namespace Management.Gherkin.Steps
|
|
||||||
{
|
|
||||||
[Binding]
|
|
||||||
public sealed class CalculatorStepDefinitions
|
|
||||||
{
|
|
||||||
|
|
||||||
// For additional details on SpecFlow step definitions see https://go.specflow.org/doc-stepdef
|
|
||||||
|
|
||||||
private readonly ScenarioContext _scenarioContext;
|
|
||||||
|
|
||||||
public CalculatorStepDefinitions(ScenarioContext scenarioContext)
|
|
||||||
{
|
|
||||||
_scenarioContext = scenarioContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Given("the first number is (.*)")]
|
|
||||||
public void GivenTheFirstNumberIs(int number)
|
|
||||||
{
|
|
||||||
//TODO: implement arrange (precondition) logic
|
|
||||||
// For storing and retrieving scenario-specific data see https://go.specflow.org/doc-sharingdata
|
|
||||||
// To use the multiline text or the table argument of the scenario,
|
|
||||||
// additional string/Table parameters can be defined on the step definition
|
|
||||||
// method.
|
|
||||||
|
|
||||||
_scenarioContext.Pending();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Given("the second number is (.*)")]
|
|
||||||
public void GivenTheSecondNumberIs(int number)
|
|
||||||
{
|
|
||||||
//TODO: implement arrange (precondition) logic
|
|
||||||
// For storing and retrieving scenario-specific data see https://go.specflow.org/doc-sharingdata
|
|
||||||
// To use the multiline text or the table argument of the scenario,
|
|
||||||
// additional string/Table parameters can be defined on the step definition
|
|
||||||
// method.
|
|
||||||
|
|
||||||
_scenarioContext.Pending();
|
|
||||||
}
|
|
||||||
|
|
||||||
[When("the two numbers are added")]
|
|
||||||
public void WhenTheTwoNumbersAreAdded()
|
|
||||||
{
|
|
||||||
//TODO: implement act (action) logic
|
|
||||||
|
|
||||||
_scenarioContext.Pending();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Then("the result should be (.*)")]
|
|
||||||
public void ThenTheResultShouldBe(int result)
|
|
||||||
{
|
|
||||||
//TODO: implement assert (verification) logic
|
|
||||||
|
|
||||||
_scenarioContext.Pending();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,8 +28,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void reload()
|
private void reload()
|
||||||
{
|
{
|
||||||
this.InvokeAsync(this.StateHasChanged);
|
this.InvokeAsync(this.StateHasChanged);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
{
|
{
|
||||||
planner.StateHasChanged -= reload;
|
planner.StateHasChanged -= reload;
|
||||||
}
|
}
|
||||||
private Modal? assignmentEditorModal { get; set; }
|
|
||||||
private bool showAll { get; set; } = false;
|
private bool showAll { get; set; } = false;
|
||||||
|
|
||||||
private void dropOnDate(DateTime dropDate)
|
private void dropOnDate(DateTime dropDate)
|
||||||
@@ -134,18 +133,15 @@
|
|||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body p-0">
|
||||||
<div class="card-title">
|
<div class="card-title pt-2 px-2 m-0">
|
||||||
<div class="row">
|
<div class="row mx-1">
|
||||||
<div class="col">
|
<div class="col offset-2 offset-lg-1 ">
|
||||||
</div>
|
<h4 class="text-center m-0">
|
||||||
<div class="col-8">
|
|
||||||
<h4 class="text-center">
|
|
||||||
@Assignment.name
|
@Assignment.name
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-end">
|
<div class="col-2 col-lg-1 text-end">
|
||||||
@if(isSyncedWithCanvas)
|
@if(isSyncedWithCanvas)
|
||||||
{
|
{
|
||||||
@if(planner.LocalCourse != null
|
@if(planner.LocalCourse != null
|
||||||
@@ -167,23 +163,15 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div>Not Synced with Canvas</div>
|
<SyncIcon />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if(!showAll)
|
@if(!showAll)
|
||||||
{
|
{
|
||||||
<div class="card-text overflow-hidden" style="max-height: 5rem;">
|
<div class="card-text overflow-hidden p-2" style="max-height: 5rem;">
|
||||||
@* @if(Assignment.use_template)
|
|
||||||
{
|
|
||||||
var html = Assignment.GetDescriptionHtml(planner.LocalCourse?.AssignmentTemplates);
|
|
||||||
@((MarkupString) html)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@Assignment.description
|
|
||||||
} *@
|
|
||||||
<div>Points: @Assignment.points_possible</div>
|
<div>Points: @Assignment.points_possible</div>
|
||||||
<div>Due At: @Assignment.due_at</div>
|
<div>Due At: @Assignment.due_at</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -191,45 +179,25 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="card-text">
|
<div class="card-text">
|
||||||
@if(Assignment.use_template)
|
<div class="px-3 py-1 bg-dark-subtle my-1">
|
||||||
{
|
|
||||||
var html = Assignment.GetDescriptionHtml(planner.LocalCourse?.AssignmentTemplates);
|
@((MarkupString) @Assignment.GetDescriptionHtml(planner.LocalCourse?.AssignmentTemplates))
|
||||||
@((MarkupString) html)
|
</div>
|
||||||
}
|
|
||||||
else
|
<section class="px-3">
|
||||||
{
|
<div>Points: @Assignment.points_possible</div>
|
||||||
@Assignment.description
|
<div>Due At: @Assignment.due_at</div>
|
||||||
}
|
<div>Lock At: @Assignment.lock_at</div>
|
||||||
|
<div>Submission Types:</div>
|
||||||
<hr>
|
<ul>
|
||||||
<div>Points: @Assignment.points_possible</div>
|
@foreach(var type in Assignment.submission_types)
|
||||||
<div>Due At: @Assignment.due_at</div>
|
{
|
||||||
<div>Lock At: @Assignment.lock_at</div>
|
<li>
|
||||||
<br>
|
@type
|
||||||
<h5>
|
</li>
|
||||||
Rubric
|
}
|
||||||
</h5>
|
</ul>
|
||||||
@foreach(var rubricItem in Assignment.rubric)
|
</section>
|
||||||
{
|
|
||||||
<div class="row m-0">
|
|
||||||
<div class="col border-end my-auto">
|
|
||||||
@rubricItem.Label
|
|
||||||
</div>
|
|
||||||
<div class="col-2 my-auto">
|
|
||||||
@rubricItem.Points
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<br>
|
|
||||||
<div>Submission Types:</div>
|
|
||||||
<ul>
|
|
||||||
@foreach(var type in Assignment.submission_types)
|
|
||||||
{
|
|
||||||
<li>
|
|
||||||
@type
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,25 +205,45 @@
|
|||||||
@if(!showAll)
|
@if(!showAll)
|
||||||
{
|
{
|
||||||
<div
|
<div
|
||||||
class="text-center"
|
class="text-center fs-3 fw-bold lh-1 text-primary"
|
||||||
role="button"
|
role="button"
|
||||||
@onclick:preventDefault="true"
|
@onclick:preventDefault="true"
|
||||||
@onclick:stopPropagation="true"
|
@onclick:stopPropagation="true"
|
||||||
@onclick="() => showAll = true"
|
@onclick="() => showAll = true"
|
||||||
>
|
>
|
||||||
...
|
<svg
|
||||||
|
width="30"
|
||||||
|
height="30"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M6 10a2 2 0 11-4.001-.001A2 2 0 016 10zm6 0a2 2 0 11-4.001-.001A2 2 0 0112 10zm6 0a2 2 0 11-4.001-.001A2 2 0 0118 10z"
|
||||||
|
fill="var(--bs-primary)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div
|
<div
|
||||||
class="text-center"
|
class="text-center fs-3 fw-bold lh-1 text-primary"
|
||||||
role="button"
|
role="button"
|
||||||
@onclick:preventDefault="true"
|
@onclick:preventDefault="true"
|
||||||
@onclick:stopPropagation="true"
|
@onclick:stopPropagation="true"
|
||||||
@onclick="() => showAll = false"
|
@onclick="() => showAll = false"
|
||||||
>
|
>
|
||||||
...
|
<svg
|
||||||
|
width="30"
|
||||||
|
height="30"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M6 10a2 2 0 11-4.001-.001A2 2 0 016 10zm6 0a2 2 0 11-4.001-.001A2 2 0 0112 10zm6 0a2 2 0 11-4.001-.001A2 2 0 0118 10z"
|
||||||
|
fill="var(--bs-primary)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,5 +255,4 @@
|
|||||||
Assignment="Assignment"
|
Assignment="Assignment"
|
||||||
Show="showUpdateForm"
|
Show="showUpdateForm"
|
||||||
OnHide="@(() => showUpdateForm = false)"
|
OnHide="@(() => showUpdateForm = false)"
|
||||||
Module="Module"
|
|
||||||
/>
|
/>
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using Markdig
|
||||||
|
|
||||||
@inject CoursePlanner planner
|
@inject CoursePlanner planner
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
.LocalCourse?
|
.LocalCourse?
|
||||||
.AssignmentTemplates
|
.AssignmentTemplates
|
||||||
.FirstOrDefault(t => t.Id == TemplateId);
|
.FirstOrDefault(t => t.Id == TemplateId);
|
||||||
|
public string Preview => Markdown.ToHtml(Description);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,17 +111,35 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<label
|
|
||||||
for="description"
|
<div class="row">
|
||||||
class="form-label"
|
<div class="col">
|
||||||
>
|
<label
|
||||||
Description
|
for="description"
|
||||||
</label>
|
class="form-label"
|
||||||
<textarea
|
>
|
||||||
id="description"
|
Description
|
||||||
class="form-control"
|
</label>
|
||||||
value="@Description"
|
</div>
|
||||||
@oninput="async (e) =>
|
<div class="col">
|
||||||
await DescriptionChanged.InvokeAsync(e.Value?.ToString() ?? String.Empty)"
|
HTML Preview
|
||||||
/>
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<textarea
|
||||||
|
id="description"
|
||||||
|
class="form-control"
|
||||||
|
value="@Description"
|
||||||
|
rows=12
|
||||||
|
@oninput="async (e) =>
|
||||||
|
await DescriptionChanged.InvokeAsync(e.Value?.ToString() ?? String.Empty)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
@((MarkupString) Preview)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,6 @@
|
|||||||
@inject CoursePlanner planner
|
@inject CoursePlanner planner
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
|
||||||
[EditorRequired]
|
|
||||||
public LocalModule Module { get; set; } = default!;
|
public LocalModule Module { get; set; } = default!;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
@@ -94,6 +92,11 @@
|
|||||||
rubric = newRubric;
|
rubric = newRubric;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
private void SetTypes(IEnumerable<string> newTypes)
|
||||||
|
{
|
||||||
|
submissionTypes = newTypes;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<Modal @ref="AssignmentModal" OnHide="@(() => OnHide())">
|
<Modal @ref="AssignmentModal" OnHide="@(() => OnHide())">
|
||||||
@@ -139,7 +142,7 @@
|
|||||||
<RubricEditor Rubric="rubric" SetRubric="updateRubric" />
|
<RubricEditor Rubric="rubric" SetRubric="updateRubric" />
|
||||||
<SubmissionTypeSelector
|
<SubmissionTypeSelector
|
||||||
Types="submissionTypes"
|
Types="submissionTypes"
|
||||||
SetTypes="(newTypes) => submissionTypes = newTypes"
|
SetTypes="SetTypes"
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</Body>
|
</Body>
|
||||||
|
|||||||
@@ -22,6 +22,13 @@
|
|||||||
);
|
);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
private void removeItem()
|
||||||
|
{
|
||||||
|
SetRubric(
|
||||||
|
Rubric.Take(Rubric.Count() - 1)
|
||||||
|
);
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
private void editItem(RubricItem newItem)
|
private void editItem(RubricItem newItem)
|
||||||
{
|
{
|
||||||
var newRubric = Rubric.Select(i => i.Id == newItem.Id ? newItem : i);
|
var newRubric = Rubric.Select(i => i.Id == newItem.Id ? newItem : i);
|
||||||
@@ -71,6 +78,14 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="text-end my-1">
|
<div class="text-end my-1">
|
||||||
|
<button
|
||||||
|
@onclick:preventDefault="true"
|
||||||
|
@onclick="removeItem"
|
||||||
|
type="button"
|
||||||
|
class="btn btn-outline-danger"
|
||||||
|
>
|
||||||
|
- rubric item
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
@onclick:preventDefault="true"
|
@onclick:preventDefault="true"
|
||||||
@onclick="addItem"
|
@onclick="addItem"
|
||||||
|
|||||||
@@ -2,8 +2,16 @@
|
|||||||
|
|
||||||
@code
|
@code
|
||||||
{
|
{
|
||||||
|
private IEnumerable<string> _types { get; set; } = Enumerable.Empty<string>();
|
||||||
[Parameter, EditorRequired]
|
[Parameter, EditorRequired]
|
||||||
public IEnumerable<string> Types { get; set; } = Enumerable.Empty<string>();
|
public IEnumerable<string> Types {
|
||||||
|
get => _types;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_types = value;
|
||||||
|
renderKey++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Parameter, EditorRequired]
|
[Parameter, EditorRequired]
|
||||||
public Action<IEnumerable<string>> SetTypes { get; set; } = (_) => {};
|
public Action<IEnumerable<string>> SetTypes { get; set; } = (_) => {};
|
||||||
@@ -11,36 +19,47 @@
|
|||||||
{
|
{
|
||||||
return type.ToString().Replace("_", "") + "switch";
|
return type.ToString().Replace("_", "") + "switch";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool discussionIsSelected
|
||||||
|
{
|
||||||
|
get => Types.FirstOrDefault(
|
||||||
|
t => t == SubmissionType.discussion_topic
|
||||||
|
) != null;
|
||||||
|
}
|
||||||
|
private int renderKey {get; set; } = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
<h5>Submission Types</h5>
|
<h5>Submission Types</h5>
|
||||||
<div class="row">
|
<div class="row" @key="Types">
|
||||||
|
|
||||||
@foreach (var submissionType in SubmissionType.AllTypes)
|
@foreach (var submissionType in SubmissionType.AllTypes)
|
||||||
{
|
{
|
||||||
<div class="col-4">
|
var isDiscussion = submissionType == SubmissionType.discussion_topic;
|
||||||
<div class="form-check form-switch">
|
var allowedToBeChecked = !discussionIsSelected || isDiscussion;
|
||||||
<input
|
<div class="col-4">
|
||||||
class="form-check-input"
|
<div class="form-check form-switch">
|
||||||
type="checkbox"
|
<input
|
||||||
role="switch"
|
class="form-check-input"
|
||||||
id="@getLabel(submissionType)"
|
type="checkbox"
|
||||||
checked="@Types.Contains(submissionType)"
|
role="switch"
|
||||||
@onchange="(e) => {
|
id="@getLabel(submissionType)"
|
||||||
var isChecked = (bool)(e.Value ?? false);
|
checked="@(Types.Contains(submissionType) && allowedToBeChecked)"
|
||||||
if(isChecked)
|
@onchange="(e) => {
|
||||||
SetTypes(Types.Append(submissionType));
|
var isChecked = (bool)(e.Value ?? false);
|
||||||
else
|
if(isChecked)
|
||||||
SetTypes(Types.Where(t => t != submissionType));
|
SetTypes(Types.Append(submissionType));
|
||||||
}"
|
else
|
||||||
>
|
SetTypes(Types.Where(t => t != submissionType));
|
||||||
<label
|
}"
|
||||||
class="form-check-label"
|
disabled="@(discussionIsSelected && !isDiscussion)"
|
||||||
for="@getLabel(submissionType)"
|
>
|
||||||
>
|
<label
|
||||||
@submissionType
|
class="form-check-label"
|
||||||
</label>
|
for="@getLabel(submissionType)"
|
||||||
|
>
|
||||||
|
@submissionType
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
{
|
{
|
||||||
planner.StateHasChanged -= reload;
|
planner.StateHasChanged -= reload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IEnumerable<LocalAssignment> TodaysAssignments {
|
private IEnumerable<LocalAssignment> TodaysAssignments {
|
||||||
get
|
get
|
||||||
@@ -53,8 +54,8 @@
|
|||||||
var isClassDay = planner.LocalCourse?.DaysOfWeek.Contains(notNullDay) ?? false;
|
var isClassDay = planner.LocalCourse?.DaysOfWeek.Contains(notNullDay) ?? false;
|
||||||
var dayInSemester =
|
var dayInSemester =
|
||||||
isClassDay
|
isClassDay
|
||||||
&& date < planner.LocalCourse?.EndDate
|
&& date <= planner.LocalCourse?.EndDate
|
||||||
&& date > planner.LocalCourse.StartDate;
|
&& date >= planner.LocalCourse?.StartDate;
|
||||||
|
|
||||||
var totalClasses = dayInSemester
|
var totalClasses = dayInSemester
|
||||||
? "bg-light-subtle text-light " + baseClasses
|
? "bg-light-subtle text-light " + baseClasses
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ public class CoursePlanner
|
|||||||
StateHasChanged?.Invoke();
|
StateHasChanged?.Invoke();
|
||||||
|
|
||||||
var (canvasAssignments, canvasModules, canvasModuleItems) = await LoadCanvasData();
|
var (canvasAssignments, canvasModules, canvasModuleItems) = await LoadCanvasData();
|
||||||
|
LoadingCanvasData = true;
|
||||||
|
StateHasChanged?.Invoke();
|
||||||
LocalCourse = LocalCourse.deleteCanvasIdsThatNoLongerExist(canvasModules, canvasAssignments);
|
LocalCourse = LocalCourse.deleteCanvasIdsThatNoLongerExist(canvasModules, canvasAssignments);
|
||||||
|
|
||||||
var canvasId =
|
var canvasId =
|
||||||
@@ -105,7 +107,7 @@ public class CoursePlanner
|
|||||||
|
|
||||||
LocalCourse = await LocalCourse.SyncModulesWithCanvasData(canvasId, CanvasModules, canvas);
|
LocalCourse = await LocalCourse.SyncModulesWithCanvasData(canvasId, CanvasModules, canvas);
|
||||||
|
|
||||||
await LocalCourse.SyncAssignmentsWithCanvas(canvasId, CanvasAssignments, canvas);
|
LocalCourse = await LocalCourse.SyncAssignmentsWithCanvas(canvasId, CanvasAssignments, canvas);
|
||||||
CanvasAssignments = await canvas.Assignments.GetAll(canvasId);
|
CanvasAssignments = await canvas.Assignments.GetAll(canvasId);
|
||||||
|
|
||||||
await syncModuleItemsWithCanvas(canvasId);
|
await syncModuleItemsWithCanvas(canvasId);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public static class CoursePlannerSyncronizationExtensions
|
|||||||
|
|
||||||
var canvasHtmlDescription = canvasAssignment.Description;
|
var canvasHtmlDescription = canvasAssignment.Description;
|
||||||
canvasHtmlDescription = Regex.Replace(canvasHtmlDescription, "<script.*script>", "");
|
canvasHtmlDescription = Regex.Replace(canvasHtmlDescription, "<script.*script>", "");
|
||||||
canvasHtmlDescription = Regex.Replace(canvasHtmlDescription, "<link .*\">", "");
|
canvasHtmlDescription = Regex.Replace(canvasHtmlDescription, "<link\\s+rel=\"[^\"]*\"\\s+href=\"[^\"]*\"[^>]*>", "");
|
||||||
|
|
||||||
var dueDatesSame = canvasAssignment.DueAt == localAssignment.due_at;
|
var dueDatesSame = canvasAssignment.DueAt == localAssignment.due_at;
|
||||||
var descriptionSame = canvasHtmlDescription == localHtmlDescription;
|
var descriptionSame = canvasHtmlDescription == localHtmlDescription;
|
||||||
@@ -131,11 +131,21 @@ public static class CoursePlannerSyncronizationExtensions
|
|||||||
|
|
||||||
if (!descriptionSame)
|
if (!descriptionSame)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine();
|
||||||
Console.WriteLine($"descriptions different for {localAssignment.name}");
|
Console.WriteLine($"descriptions different for {localAssignment.name}");
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
Console.WriteLine("Local Description:");
|
Console.WriteLine("Local Description:");
|
||||||
Console.WriteLine(localHtmlDescription);
|
Console.WriteLine(localHtmlDescription);
|
||||||
|
Console.WriteLine();
|
||||||
Console.WriteLine("Canvas Description: ");
|
Console.WriteLine("Canvas Description: ");
|
||||||
Console.WriteLine(canvasHtmlDescription);
|
Console.WriteLine(canvasHtmlDescription);
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine("Canvas Raw Description: ");
|
||||||
|
Console.WriteLine(canvasAssignment.Description);
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nameSame)
|
if (!nameSame)
|
||||||
|
|||||||
@@ -8,17 +8,33 @@ public static class CoursePlannerExtensions
|
|||||||
{
|
{
|
||||||
public static LocalCourse GeneralCourseCleanup(this LocalCourse incomingCourse)
|
public static LocalCourse GeneralCourseCleanup(this LocalCourse incomingCourse)
|
||||||
{
|
{
|
||||||
var modulesWithUniqueAssignments = incomingCourse.Modules.Select(
|
var cleanModules = incomingCourse.Modules.Select(
|
||||||
module =>
|
module =>
|
||||||
module with
|
module with
|
||||||
{
|
{
|
||||||
Assignments = module.Assignments.OrderBy(a => a.due_at).DistinctBy(a => a.id)
|
Assignments = module.Assignments
|
||||||
|
.OrderBy(a => a.due_at)
|
||||||
|
.DistinctBy(a => a.id)
|
||||||
|
.Select(a => a.validateSubmissionTypes())
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var cleanStartDay = new DateTime(
|
||||||
|
incomingCourse.StartDate.Year,
|
||||||
|
incomingCourse.StartDate.Month,
|
||||||
|
incomingCourse.StartDate.Day
|
||||||
|
);
|
||||||
|
var cleanEndDay = new DateTime(
|
||||||
|
incomingCourse.EndDate.Year,
|
||||||
|
incomingCourse.EndDate.Month,
|
||||||
|
incomingCourse.EndDate.Day
|
||||||
|
);
|
||||||
|
|
||||||
return incomingCourse with
|
return incomingCourse with
|
||||||
{
|
{
|
||||||
Modules = modulesWithUniqueAssignments
|
Modules = cleanModules,
|
||||||
|
StartDate = cleanStartDay,
|
||||||
|
EndDate = cleanEndDay,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,4 +96,17 @@ public static class CoursePlannerExtensions
|
|||||||
}
|
}
|
||||||
return assignment;
|
return assignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LocalAssignment validateSubmissionTypes(this LocalAssignment assignment)
|
||||||
|
{
|
||||||
|
var containsDiscussion =
|
||||||
|
assignment.submission_types.FirstOrDefault(t => t == SubmissionType.discussion_topic) != null;
|
||||||
|
|
||||||
|
if (containsDiscussion)
|
||||||
|
return assignment with
|
||||||
|
{
|
||||||
|
submission_types = new string[] { SubmissionType.discussion_topic }
|
||||||
|
};
|
||||||
|
return assignment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class CanvasAssignmentService
|
|||||||
{
|
{
|
||||||
name = localAssignment.name,
|
name = localAssignment.name,
|
||||||
submission_types = localAssignment.submission_types.Select(t => t.ToString()),
|
submission_types = localAssignment.submission_types.Select(t => t.ToString()),
|
||||||
description = localAssignment.description ?? "",
|
description = htmlDescription,
|
||||||
due_at = localAssignment.due_at,
|
due_at = localAssignment.due_at,
|
||||||
lock_at = localAssignment.lock_at,
|
lock_at = localAssignment.lock_at,
|
||||||
points_possible = localAssignment.points_possible
|
points_possible = localAssignment.points_possible
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.0.31903.59
|
VisualStudioVersion = 17.0.31903.59
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management", "Management\Management.csproj", "{35B6CD41-4B43-42F4-929C-32694D1607EA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management", "Management\Management.csproj", "{FC5771C2-8752-4871-B0CA-A9C9AC5E4CA5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management.Test", "Management.Test\Management.Test.csproj", "{70AD8D71-7696-48A3-ACA6-C8D2081693F1}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management.Test", "Management.Test\Management.Test.csproj", "{1C1D51D9-FE2F-47E9-B60F-BAAFBA0808C0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management.Web", "Management.Web\Management.Web.csproj", "{1BDBA09F-5CD1-461F-AD2F-2B25CA2CD454}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management.Web", "Management.Web\Management.Web.csproj", "{8828A70D-8DAD-4FD0-870A-6437595BCE8F}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -18,17 +18,17 @@ Global
|
|||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{35B6CD41-4B43-42F4-929C-32694D1607EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{FC5771C2-8752-4871-B0CA-A9C9AC5E4CA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{35B6CD41-4B43-42F4-929C-32694D1607EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FC5771C2-8752-4871-B0CA-A9C9AC5E4CA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{35B6CD41-4B43-42F4-929C-32694D1607EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FC5771C2-8752-4871-B0CA-A9C9AC5E4CA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{35B6CD41-4B43-42F4-929C-32694D1607EA}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FC5771C2-8752-4871-B0CA-A9C9AC5E4CA5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{70AD8D71-7696-48A3-ACA6-C8D2081693F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1C1D51D9-FE2F-47E9-B60F-BAAFBA0808C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{70AD8D71-7696-48A3-ACA6-C8D2081693F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1C1D51D9-FE2F-47E9-B60F-BAAFBA0808C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{70AD8D71-7696-48A3-ACA6-C8D2081693F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1C1D51D9-FE2F-47E9-B60F-BAAFBA0808C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{70AD8D71-7696-48A3-ACA6-C8D2081693F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1C1D51D9-FE2F-47E9-B60F-BAAFBA0808C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{1BDBA09F-5CD1-461F-AD2F-2B25CA2CD454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{8828A70D-8DAD-4FD0-870A-6437595BCE8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{1BDBA09F-5CD1-461F-AD2F-2B25CA2CD454}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{8828A70D-8DAD-4FD0-870A-6437595BCE8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{1BDBA09F-5CD1-461F-AD2F-2B25CA2CD454}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{8828A70D-8DAD-4FD0-870A-6437595BCE8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1BDBA09F-5CD1-461F-AD2F-2B25CA2CD454}.Release|Any CPU.Build.0 = Release|Any CPU
|
{8828A70D-8DAD-4FD0-870A-6437595BCE8F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
Reference in New Issue
Block a user