mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
ripped out lock at due date flag
This commit is contained in:
@@ -7,7 +7,9 @@ public class AssignmentMarkdownTests
|
||||
{
|
||||
var assignment = new LocalAssignment()
|
||||
{
|
||||
|
||||
Name="test assignment",
|
||||
Description ="here is the description",
|
||||
// LockAtDueDate = false
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@
|
||||
if (assignmentContext.Assignment != null)
|
||||
{
|
||||
name = assignmentContext.Assignment.Name;
|
||||
lockAtDueDate = assignmentContext.Assignment.LockAtDueDate;
|
||||
}
|
||||
this.InvokeAsync(this.StateHasChanged);
|
||||
}
|
||||
@@ -32,11 +31,8 @@
|
||||
{
|
||||
assignmentContext.Assignment = null;
|
||||
name = "";
|
||||
lockAtDueDate = false;
|
||||
}
|
||||
private string name { get; set; } = String.Empty;
|
||||
private bool lockAtDueDate { get; set; }
|
||||
|
||||
private bool addingAssignmentToCanvas = false;
|
||||
private bool deletingAssignmentFromCanvas = false;
|
||||
|
||||
@@ -47,7 +43,6 @@
|
||||
var newAssignment = assignmentContext.Assignment with
|
||||
{
|
||||
Name = name,
|
||||
LockAtDueDate = lockAtDueDate,
|
||||
};
|
||||
|
||||
assignmentContext.SaveAssignment(newAssignment);
|
||||
@@ -88,6 +83,7 @@
|
||||
ulong courseId = planner.LocalCourse.Settings.CanvasId ?? throw new Exception("cannot delete if no course id");
|
||||
await canvas.Assignments.Delete(courseId, assignmentInCanvas.Id, assignment.Name);
|
||||
}
|
||||
Navigation.NavigateTo("/course/" + planner.LocalCourse?.Settings.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,23 +96,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
private void handleLockAtDueDateChange(ChangeEventArgs e)
|
||||
{
|
||||
if (assignmentContext.Assignment != null)
|
||||
{
|
||||
var lockAtDueDate = (bool)(e.Value ?? false);
|
||||
var lockAtDate = lockAtDueDate
|
||||
? assignmentContext.Assignment.DueAt
|
||||
: assignmentContext.Assignment.LockAt;
|
||||
var newAssignment = assignmentContext.Assignment with
|
||||
{
|
||||
LockAtDueDate = lockAtDueDate,
|
||||
LockAt = lockAtDate,
|
||||
};
|
||||
assignmentContext.SaveAssignment(newAssignment);
|
||||
}
|
||||
}
|
||||
|
||||
private void setAssignmentGroup(LocalAssignmentGroup? group)
|
||||
{
|
||||
if (assignmentContext.Assignment == null)
|
||||
@@ -181,8 +160,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
<div class="d-flex flex-column h-100">
|
||||
<div>
|
||||
@assignmentContext.Assignment?.Name
|
||||
@@ -208,13 +185,6 @@
|
||||
<AssignmentDescriptionEditor />
|
||||
</div>
|
||||
|
||||
<div class="form-check m-1">
|
||||
<input class="form-check-input" id="lockAtDueDate" type="checkbox" @bind="lockAtDueDate"
|
||||
@oninput="handleLockAtDueDateChange" />
|
||||
<label class="form-check-label" for="lockAtDueDate">
|
||||
Lock At Due Date
|
||||
</label>
|
||||
</div>
|
||||
<div class="container">
|
||||
<RubricMarkdownEditor />
|
||||
<hr>
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
{
|
||||
Name = Name,
|
||||
Description = "",
|
||||
LockAtDueDate = true,
|
||||
@* LockAtDueDate = true, *@
|
||||
Rubric = new RubricItem[] { },
|
||||
LockAt = null,
|
||||
LockAt = DateTime.Now,
|
||||
DueAt = DateTime.Now,
|
||||
SubmissionTypes = new string[] { SubmissionType.ONLINE_TEXT_ENTRY },
|
||||
LocalAssignmentGroupName = selectedAssignmentGroup?.Name,
|
||||
|
||||
@@ -62,7 +62,7 @@ public static class CoursePlannerExtensions
|
||||
return assignment with
|
||||
{
|
||||
DueAt = dueAt,
|
||||
LockAt = assignment.LockAtDueDate ? dueAt : lockAt
|
||||
LockAt = lockAt
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,18 +140,16 @@ public static partial class AssignmentSyncronizationExtensions
|
||||
second: canvasAssignment.LockAt.Value.Second
|
||||
)
|
||||
: new DateTime();
|
||||
var localComparisonLockDate = localAssignment.LockAtDueDate
|
||||
? localComparisonDueDate
|
||||
: canvasAssignment.LockAt != null
|
||||
? new DateTime(
|
||||
year: localAssignment.LockAt?.Year ?? 0,
|
||||
month: localAssignment.LockAt?.Month ?? 0,
|
||||
day: localAssignment.LockAt?.Day ?? 0,
|
||||
hour: localAssignment.LockAt?.Hour ?? 0,
|
||||
minute: localAssignment.LockAt?.Minute ?? 0,
|
||||
second: localAssignment.LockAt?.Second ?? 0
|
||||
)
|
||||
: new DateTime();
|
||||
var localComparisonLockDate = canvasAssignment.LockAt != null
|
||||
? new DateTime(
|
||||
year: localAssignment.LockAt?.Year ?? 0,
|
||||
month: localAssignment.LockAt?.Month ?? 0,
|
||||
day: localAssignment.LockAt?.Day ?? 0,
|
||||
hour: localAssignment.LockAt?.Hour ?? 0,
|
||||
minute: localAssignment.LockAt?.Minute ?? 0,
|
||||
second: localAssignment.LockAt?.Second ?? 0
|
||||
)
|
||||
: new DateTime();
|
||||
|
||||
var dueDatesSame =
|
||||
canvasAssignment.DueAt != null && canvasComparisonDueDate == localComparisonDueDate;
|
||||
|
||||
@@ -45,7 +45,7 @@ public record LocalAssignment
|
||||
// public ulong? CanvasId { get; init; } = null;
|
||||
public string Name { get; init; } = "";
|
||||
public string Description { get; init; } = "";
|
||||
public bool LockAtDueDate { get; init; }
|
||||
// public bool LockAtDueDate { get; init; }
|
||||
public IEnumerable<RubricItem> Rubric { get; init; } = Array.Empty<RubricItem>();
|
||||
public DateTime? LockAt { get; init; }
|
||||
public DateTime DueAt { get; init; }
|
||||
|
||||
@@ -51,7 +51,7 @@ public class CanvasAssignmentService
|
||||
submission_types = localAssignment.SubmissionTypes.Select(t => t.ToString()),
|
||||
description = htmlDescription,
|
||||
due_at = localAssignment.DueAt,
|
||||
lock_at = localAssignment.LockAtDueDate ? localAssignment.DueAt : localAssignment.LockAt,
|
||||
lock_at = localAssignment.LockAt,
|
||||
points_possible = localAssignment.PointsPossible,
|
||||
assignment_group_id = canvasAssignmentGroupId,
|
||||
};
|
||||
@@ -84,7 +84,7 @@ public class CanvasAssignmentService
|
||||
submission_types = localAssignment.SubmissionTypes.Select(t => t.ToString()),
|
||||
description = localAssignment.GetDescriptionHtml(),
|
||||
due_at = localAssignment.DueAt,
|
||||
lock_at = localAssignment.LockAtDueDate ? localAssignment.DueAt : localAssignment.LockAt,
|
||||
lock_at = localAssignment.LockAt,
|
||||
points_possible = localAssignment.PointsPossible,
|
||||
assignment_group_id = canvasAssignmentGroupId,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user