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