mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
added better previews
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
a => a.Name == Assignment.Name
|
||||
);
|
||||
|
||||
private bool isSyncedWithCanvas =>
|
||||
private bool existsInCanvas =>
|
||||
assignmentInCanvas != null;
|
||||
private void OnClick()
|
||||
{
|
||||
@@ -52,14 +52,14 @@
|
||||
}
|
||||
|
||||
private bool NeedsToBeUpdatedInCanvas => planner.LocalCourse != null
|
||||
&& planner.LocalCourse.Settings.CanvasId != null
|
||||
&& planner.CanvasAssignments != null
|
||||
&& planner.CanvasModules != null
|
||||
&& assignmentInCanvas != null
|
||||
&& Assignment.NeedsUpdates(
|
||||
(CanvasAssignment)assignmentInCanvas,
|
||||
Assignment.GetCanvasAssignmentGroupId(planner.LocalCourse.Settings.AssignmentGroups)
|
||||
);
|
||||
&& planner.LocalCourse.Settings.CanvasId != null
|
||||
&& planner.CanvasAssignments != null
|
||||
&& planner.CanvasModules != null
|
||||
&& assignmentInCanvas != null
|
||||
&& Assignment.NeedsUpdates(
|
||||
(CanvasAssignment)assignmentInCanvas,
|
||||
Assignment.GetCanvasAssignmentGroupId(planner.LocalCourse.Settings.AssignmentGroups)
|
||||
);
|
||||
}
|
||||
|
||||
<div
|
||||
@@ -79,7 +79,7 @@
|
||||
</h4>
|
||||
</div>
|
||||
<div class="col-2 col-lg-1 text-end">
|
||||
@if(isSyncedWithCanvas)
|
||||
@if(existsInCanvas)
|
||||
{
|
||||
@if(NeedsToBeUpdatedInCanvas)
|
||||
{
|
||||
@@ -98,7 +98,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(isSyncedWithCanvas && NeedsToBeUpdatedInCanvas)
|
||||
@if(existsInCanvas && NeedsToBeUpdatedInCanvas)
|
||||
{
|
||||
<div class="mx-3 text-body-tertiary">
|
||||
@Assignment.GetUpdateReason(
|
||||
@@ -106,6 +106,12 @@
|
||||
Assignment.GetCanvasAssignmentGroupId(planner.LocalCourse.Settings.AssignmentGroups))
|
||||
</div>
|
||||
}
|
||||
@if(!existsInCanvas)
|
||||
{
|
||||
<div class="mx-3 text-body-tertiary">
|
||||
no assignment with same name in canvas
|
||||
</div>
|
||||
}
|
||||
|
||||
@if(!showAll)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{
|
||||
dragContainer.DropCallback = null;
|
||||
}
|
||||
private bool isSyncedWithCanvas =>
|
||||
private bool existsInCanvas =>
|
||||
planner.CanvasQuizzes != null
|
||||
? Quiz.QuizIsCreated(planner.CanvasQuizzes)
|
||||
: false;
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="card-body p-0">
|
||||
<div class="card-title pt-2 px-2 m-0 d-flex justify-content-between">
|
||||
<h4>@Quiz.Name</h4>
|
||||
@if(isSyncedWithCanvas)
|
||||
@if(existsInCanvas)
|
||||
{
|
||||
<CheckIcon />
|
||||
}
|
||||
@@ -52,6 +52,12 @@
|
||||
<SyncIcon />
|
||||
}
|
||||
</div>
|
||||
@if(!existsInCanvas)
|
||||
{
|
||||
<div class="mx-3 text-body-tertiary">
|
||||
no quiz with same name in canvas
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="card-text overflow-hidden p-2">
|
||||
<div>Due At: @Quiz.DueAt</div>
|
||||
|
||||
@@ -78,17 +78,9 @@ public static partial class AssignmentSyncronizationExtensions
|
||||
this LocalAssignment localAssignment,
|
||||
CanvasAssignment canvasAssignment,
|
||||
ulong? canvasAssignmentGroupId,
|
||||
bool quiet = false
|
||||
bool quiet = true
|
||||
)
|
||||
{
|
||||
|
||||
var localHtmlDescription = removeHtmlDetails(localAssignment.GetDescriptionHtml());
|
||||
|
||||
var canvasHtmlDescription = canvasAssignment.Description;
|
||||
canvasHtmlDescription = CanvasScriptTagRegex().Replace(canvasHtmlDescription, "");
|
||||
canvasHtmlDescription = CanvasLinkTagRegex().Replace(canvasHtmlDescription, "");
|
||||
canvasHtmlDescription = removeHtmlDetails(canvasHtmlDescription);
|
||||
|
||||
var canvasComparisonDueDate =
|
||||
canvasAssignment.DueAt != null
|
||||
? new DateTime(
|
||||
@@ -111,48 +103,10 @@ public static partial class AssignmentSyncronizationExtensions
|
||||
second: localAssignment.DueAt.Second
|
||||
)
|
||||
: new DateTime();
|
||||
|
||||
var canvasComparisonLockDate =
|
||||
canvasAssignment.LockAt != null
|
||||
? new DateTime(
|
||||
year: canvasAssignment.LockAt.Value.Year,
|
||||
month: canvasAssignment.LockAt.Value.Month,
|
||||
day: canvasAssignment.LockAt.Value.Day,
|
||||
hour: canvasAssignment.LockAt.Value.Hour,
|
||||
minute: canvasAssignment.LockAt.Value.Minute,
|
||||
second: canvasAssignment.LockAt.Value.Second
|
||||
)
|
||||
: new DateTime();
|
||||
var localComparisonLockDate = canvasAssignment.LockAt != null
|
||||
? new DateTime(
|
||||
year: localAssignment.LockAt?.Year ?? 1,
|
||||
month: localAssignment.LockAt?.Month ?? 1,
|
||||
day: localAssignment.LockAt?.Day ?? 1,
|
||||
hour: localAssignment.LockAt?.Hour ?? 0,
|
||||
minute: localAssignment.LockAt?.Minute ?? 0,
|
||||
second: localAssignment.LockAt?.Second ?? 0
|
||||
)
|
||||
: new DateTime();
|
||||
|
||||
var dueDatesSame =
|
||||
canvasAssignment.DueAt != null && canvasComparisonDueDate == localComparisonDueDate;
|
||||
var lockDatesSame = canvasAssignment.LockAt != null && canvasComparisonLockDate == localComparisonLockDate;
|
||||
|
||||
|
||||
var descriptionSame = canvasHtmlDescription == localHtmlDescription;
|
||||
var nameSame = canvasAssignment.Name == localAssignment.Name;
|
||||
var pointsSame = canvasAssignment.PointsPossible == localAssignment.PointsPossible;
|
||||
var submissionTypesSame = canvasAssignment.SubmissionTypes.SequenceEqual(
|
||||
localAssignment.SubmissionTypes.Select(t => t.ToString())
|
||||
);
|
||||
var assignmentGroupSame =
|
||||
canvasAssignmentGroupId != null
|
||||
&& canvasAssignmentGroupId == canvasAssignment.AssignmentGroupId;
|
||||
|
||||
var reason = "";
|
||||
var dueDatesSame = canvasAssignment.DueAt != null && canvasComparisonDueDate == localComparisonDueDate;
|
||||
if (!dueDatesSame)
|
||||
{
|
||||
reason = $"Due dates different for assignment {localAssignment.Name}, local: {localAssignment.DueAt}, in canvas {canvasAssignment.DueAt}";
|
||||
var reason = $"Due dates different for assignment {localAssignment.Name}, local: {localAssignment.DueAt}, in canvas {canvasAssignment.DueAt}";
|
||||
if (!quiet)
|
||||
{
|
||||
Console.WriteLine(JsonSerializer.Serialize(canvasAssignment));
|
||||
@@ -165,12 +119,37 @@ public static partial class AssignmentSyncronizationExtensions
|
||||
return reason;
|
||||
}
|
||||
|
||||
if (!lockDatesSame)
|
||||
|
||||
DateTime? canvasComparisonLockDate = canvasAssignment.LockAt != null
|
||||
? new DateTime(
|
||||
year: canvasAssignment.LockAt.Value.Year,
|
||||
month: canvasAssignment.LockAt.Value.Month,
|
||||
day: canvasAssignment.LockAt.Value.Day,
|
||||
hour: canvasAssignment.LockAt.Value.Hour,
|
||||
minute: canvasAssignment.LockAt.Value.Minute,
|
||||
second: canvasAssignment.LockAt.Value.Second
|
||||
)
|
||||
: null;
|
||||
DateTime? localComparisonLockDate = localAssignment.LockAt != null
|
||||
? new DateTime(
|
||||
year: localAssignment.LockAt.Value.Year,
|
||||
month: localAssignment.LockAt.Value.Month,
|
||||
day: localAssignment.LockAt.Value.Day,
|
||||
hour: localAssignment.LockAt.Value.Hour,
|
||||
minute: localAssignment.LockAt.Value.Minute,
|
||||
second: localAssignment.LockAt.Value.Second
|
||||
)
|
||||
: null;
|
||||
|
||||
if (canvasComparisonLockDate != localComparisonLockDate)
|
||||
{
|
||||
reason = $"Lock dates different for assignment {localAssignment.Name}, local: {localAssignment.LockAt}, in canvas {canvasAssignment.LockAt}";
|
||||
var printableLocal = localComparisonLockDate?.ToString() ?? "null";
|
||||
var printableCanvas = canvasComparisonLockDate?.ToString() ?? "null";
|
||||
var reason = $"Lock dates different for assignment {localAssignment.Name}, local: {printableLocal}, in canvas {printableCanvas}";
|
||||
|
||||
if (!quiet)
|
||||
{
|
||||
Console.WriteLine(JsonSerializer.Serialize(canvasAssignment));
|
||||
// Console.WriteLine(JsonSerializer.Serialize(canvasAssignment));
|
||||
Console.WriteLine(canvasComparisonLockDate);
|
||||
Console.WriteLine(localComparisonLockDate);
|
||||
Console.WriteLine(reason);
|
||||
@@ -180,9 +159,19 @@ public static partial class AssignmentSyncronizationExtensions
|
||||
return reason;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var localHtmlDescription = removeHtmlDetails(localAssignment.GetDescriptionHtml());
|
||||
|
||||
var canvasHtmlDescription = canvasAssignment.Description;
|
||||
canvasHtmlDescription = CanvasScriptTagRegex().Replace(canvasHtmlDescription, "");
|
||||
canvasHtmlDescription = CanvasLinkTagRegex().Replace(canvasHtmlDescription, "");
|
||||
canvasHtmlDescription = removeHtmlDetails(canvasHtmlDescription);
|
||||
|
||||
var descriptionSame = canvasHtmlDescription == localHtmlDescription;
|
||||
if (!descriptionSame)
|
||||
{
|
||||
reason = $"descriptions different for {localAssignment.Name}";
|
||||
var reason = $"descriptions different for {localAssignment.Name}";
|
||||
if (!quiet)
|
||||
{
|
||||
Console.WriteLine();
|
||||
@@ -202,36 +191,50 @@ public static partial class AssignmentSyncronizationExtensions
|
||||
return reason;
|
||||
}
|
||||
|
||||
if (!nameSame)
|
||||
|
||||
if (canvasAssignment.Name != localAssignment.Name)
|
||||
{
|
||||
reason = $"names different for {localAssignment.Name}, local: {localAssignment.Name}, in canvas {canvasAssignment.Name}";
|
||||
if (!quiet)
|
||||
Console.WriteLine(reason);
|
||||
return reason;
|
||||
}
|
||||
if (!pointsSame)
|
||||
{
|
||||
reason = $"Points different for {localAssignment.Name}, local: {localAssignment.PointsPossible}, in canvas {canvasAssignment.PointsPossible}";
|
||||
if (!quiet)
|
||||
Console.WriteLine(reason);
|
||||
return reason;
|
||||
}
|
||||
if (!submissionTypesSame)
|
||||
{
|
||||
reason = $"Submission Types different for {localAssignment.Name}, local: {JsonSerializer.Serialize(localAssignment.SubmissionTypes.Select(t => t.ToString()))}, in canvas {JsonSerializer.Serialize(canvasAssignment.SubmissionTypes)}";
|
||||
if (!quiet)
|
||||
Console.WriteLine(reason);
|
||||
return reason;
|
||||
}
|
||||
if (!assignmentGroupSame)
|
||||
{
|
||||
reason = $"Canvas assignment group ids different for {localAssignment.Name}, local: {canvasAssignmentGroupId}, in canvas {canvasAssignment.AssignmentGroupId}";
|
||||
var reason = $"names different for {localAssignment.Name}, local: {localAssignment.Name}, in canvas {canvasAssignment.Name}";
|
||||
if (!quiet)
|
||||
Console.WriteLine(reason);
|
||||
return reason;
|
||||
}
|
||||
|
||||
return reason;
|
||||
|
||||
var pointsSame = canvasAssignment.PointsPossible == localAssignment.PointsPossible;
|
||||
if (!pointsSame)
|
||||
{
|
||||
var reason = $"Points different for {localAssignment.Name}, local: {localAssignment.PointsPossible}, in canvas {canvasAssignment.PointsPossible}";
|
||||
if (!quiet)
|
||||
Console.WriteLine(reason);
|
||||
return reason;
|
||||
}
|
||||
|
||||
|
||||
var submissionTypesSame = canvasAssignment.SubmissionTypes.SequenceEqual(
|
||||
localAssignment.SubmissionTypes.Select(t => t.ToString())
|
||||
);
|
||||
if (!submissionTypesSame)
|
||||
{
|
||||
var reason = $"Submission Types different for {localAssignment.Name}, local: {JsonSerializer.Serialize(localAssignment.SubmissionTypes.Select(t => t.ToString()))}, in canvas {JsonSerializer.Serialize(canvasAssignment.SubmissionTypes)}";
|
||||
if (!quiet)
|
||||
Console.WriteLine(reason);
|
||||
return reason;
|
||||
}
|
||||
|
||||
|
||||
var assignmentGroupSame =
|
||||
canvasAssignmentGroupId != null
|
||||
&& canvasAssignmentGroupId == canvasAssignment.AssignmentGroupId;
|
||||
if (!assignmentGroupSame)
|
||||
{
|
||||
var reason = $"Canvas assignment group ids different for {localAssignment.Name}, local: {canvasAssignmentGroupId}, in canvas {canvasAssignment.AssignmentGroupId}";
|
||||
if (!quiet)
|
||||
Console.WriteLine(reason);
|
||||
return reason;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string removeHtmlDetails(string canvasHtmlDescription) => canvasHtmlDescription
|
||||
|
||||
20
README.md
20
README.md
@@ -42,23 +42,3 @@ AssignmentGroupName: Final Project
|
||||
SubmissionTypes:
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
Local Description:
|
||||
pMake a new C# console program./p
|
||||
pAdd functionality to your program to ask the user three different questions and include their responses in a message back to the user. For example, ask the user their name then ask their age then ask their favorite food. Then tell the user Your name is {name}, your age is {age}, and you like to eat {favoriteFood}./p
|
||||
pSubmit a copy of your code via canvas./p
|
||||
hrh2Rubric/h2- 7pts: code submitted and correctly runs br/
|
||||
|
||||
Canvas Description:
|
||||
pMake a new C# console program./p
|
||||
pAdd functionality to your program to ask the user three different questions and include their responses in a message back to the user. For example, ask the user their name then ask their age then ask their favorite food. Then tell the user Your name is {name}, your age is {age}, and you like to eat {favoriteFood}./p
|
||||
pSubmit a copy of your code via canvas./p
|
||||
hrh2Rubric/h2- 7pts: code submitted and correctly runs br
|
||||
|
||||
Canvas Raw Description:
|
||||
<link rel="stylesheet" href="https://instructure-uploads-2.s3.amazonaws.com/account_20000000000010/attachments/118917933/canvas_global_app.css"><p>Make a new C# console program.</p>
|
||||
<p>Add functionality to your program to ask the user three different questions and include their responses in a message back to the user. For example, ask the user their name then ask their age then ask their favorite food. Then tell the user "Your name is {name}, your age is {age}, and you like to eat {favoriteFood}".</p>
|
||||
<p>Submit a copy of your code via canvas.</p>
|
||||
<hr><h2>Rubric</h2>- 7pts: code submitted and correctly runs <br><script src="https://instructure-uploads-2.s3.amazonaws.com/account_20000000000010/attachments/152669279/Canvas_Theme_Sept_2023.js"></script>
|
||||
Reference in New Issue
Block a user