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() private void reload()
{ {
if (assignmentContext.Assignment != null) if (assignmentContext.Assignment != null)
{
if(description == string.Empty)
{ {
description = assignmentContext.Assignment.Description; description = assignmentContext.Assignment.Description;
descriptionForPreview = description; descriptionForPreview = description;
this.InvokeAsync(this.StateHasChanged);
}
if(TemplateId == string.Empty || TemplateId == null)
{
TemplateId = assignmentContext.Assignment.TemplateId; TemplateId = assignmentContext.Assignment.TemplateId;
UseTemplate = TemplateId != null && TemplateId != ""; UseTemplate = TemplateId != null && TemplateId != "";
VariableValues = assignmentContext.Assignment.TemplateVariables; VariableValues = assignmentContext.Assignment.TemplateVariables;
this.InvokeAsync(this.StateHasChanged); this.InvokeAsync(this.StateHasChanged);
} }
} }
}
public void Dispose() public void Dispose()
{ {
assignmentContext.StateHasChanged -= reload; assignmentContext.StateHasChanged -= reload;
} }
private string description { get; set; } = default!; private string description { get; set; } = string.Empty;
private string descriptionForPreview { get; set; } = default!; private string descriptionForPreview { get; set; } = string.Empty;
public bool? UseTemplate { get; set; } = null; public bool? UseTemplate { get; set; } = null;
public string? TemplateId { get; set; } public string? TemplateId { get; set; }

View File

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

View File

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