mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
removed id from rubric
This commit is contained in:
@@ -48,7 +48,6 @@
|
||||
{
|
||||
rubric = rubric.Append(new RubricItem
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
Label = "",
|
||||
Points = 0
|
||||
});
|
||||
@@ -62,11 +61,11 @@
|
||||
save();
|
||||
}
|
||||
}
|
||||
private void editItem(RubricItem newItem)
|
||||
private void editItem(RubricItem newItem, int index)
|
||||
{
|
||||
if (assignmentContext.Assignment != null)
|
||||
{
|
||||
rubric = rubric.Select(i => i.Id == newItem.Id ? newItem : i);
|
||||
rubric = rubric.Select((r, i) => i == index ? newItem : r);
|
||||
save();
|
||||
}
|
||||
}
|
||||
@@ -85,6 +84,7 @@
|
||||
rubric = rubricList;
|
||||
save();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
private void MoveDown(RubricItem item)
|
||||
@@ -102,6 +102,7 @@
|
||||
rubric = rubricList;
|
||||
save();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,11 +130,12 @@
|
||||
</div>
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach (var rubricItem in rubric)
|
||||
@foreach (var (rubricItem, index) in rubric.Select((r, i) => (r, i)))
|
||||
{
|
||||
<RubricEditorItem
|
||||
@key="@(rubricItem with {Label = ""})"
|
||||
RubricItem="rubricItem"
|
||||
OnUpdate="editItem"
|
||||
OnUpdate="(newItem) => editItem(newItem, index)"
|
||||
MoveUp="() => MoveUp(rubricItem)"
|
||||
MoveDown="() => MoveDown(rubricItem)"
|
||||
/>
|
||||
|
||||
@@ -15,17 +15,18 @@
|
||||
|
||||
private int points { get; set; }
|
||||
private string label { get; set; }
|
||||
private string lastRubricItemId { get; set; }
|
||||
private bool firstLoad = true;
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if(RubricItem.Id != lastRubricItemId)
|
||||
if(firstLoad)
|
||||
{
|
||||
lastRubricItemId = RubricItem.Id;
|
||||
firstLoad = false;
|
||||
points = RubricItem.Points;
|
||||
label = RubricItem.Label;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void editItem(string label, int points)
|
||||
{
|
||||
var newRubricItem = RubricItem with
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace LocalModels;
|
||||
public record RubricItem
|
||||
{
|
||||
public static readonly string extraCredit = "(Extra Credit) ";
|
||||
public string Id { get; set; } = "";
|
||||
public string Label { get; set; } = "";
|
||||
public int Points { get; set; } = 0;
|
||||
public bool IsExtraCredit => Label.Contains(extraCredit);
|
||||
@@ -40,7 +39,6 @@ public static class SubmissionType
|
||||
|
||||
public record LocalAssignment
|
||||
{
|
||||
public string Id { get; init; } = "";
|
||||
public ulong? CanvasId { get; init; } = null;
|
||||
public string Name { get; init; } = "";
|
||||
public string Description { get; init; } = "";
|
||||
|
||||
Reference in New Issue
Block a user