fixed bug where rubric was resetting description

This commit is contained in:
2023-08-21 11:05:22 -06:00
parent ebf304fdf5
commit 3bc4210a56
3 changed files with 17 additions and 8 deletions

View File

@@ -13,22 +13,29 @@
private void reload()
{
if (assignmentContext.Assignment != null)
{
if(description == string.Empty)
{
description = assignmentContext.Assignment.Description;
descriptionForPreview = description;
this.InvokeAsync(this.StateHasChanged);
}
if(TemplateId == string.Empty || TemplateId == null)
{
TemplateId = assignmentContext.Assignment.TemplateId;
UseTemplate = TemplateId != null && TemplateId != "";
VariableValues = assignmentContext.Assignment.TemplateVariables;
this.InvokeAsync(this.StateHasChanged);
}
}
}
public void Dispose()
{
assignmentContext.StateHasChanged -= reload;
}
private string description { get; set; } = default!;
private string descriptionForPreview { get; set; } = default!;
private string description { get; set; } = string.Empty;
private string descriptionForPreview { get; set; } = string.Empty;
public bool? UseTemplate { get; set; } = null;
public string? TemplateId { get; set; }

View File

@@ -38,6 +38,7 @@
Rubric = rubric,
PointsPossible = totalRubricPoints,
};
Console.WriteLine(assignmentContext.Assignment.Description);
assignmentContext.SaveAssignment(newAssignment);
StateHasChanged();
}

View File

@@ -45,6 +45,7 @@ public class AssignmentEditorContext
)
.ToArray();
Assignment = newAssignment;
planner.LocalCourse = planner.LocalCourse with { Modules = updatedModules };
}
}