mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
adding last saved course to try to reduces excessive file writes
This commit is contained in:
@@ -23,9 +23,9 @@ public class FileStorageManager
|
||||
this.logger.Log("Using storage directory: " + _basePath);
|
||||
|
||||
}
|
||||
public async Task SaveCourseAsync(LocalCourse course)
|
||||
public async Task SaveCourseAsync(LocalCourse course, LocalCourse? previouslyStoredCourse)
|
||||
{
|
||||
await _saveMarkdownCourse.Save(course);
|
||||
await _saveMarkdownCourse.Save(course, previouslyStoredCourse);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class MarkdownCourseSaver
|
||||
_basePath = FileConfiguration.GetBasePath();
|
||||
}
|
||||
|
||||
public async Task Save(LocalCourse course)
|
||||
public async Task Save(LocalCourse course, LocalCourse? previouslyStoredCourse)
|
||||
{
|
||||
var courseDirectory = $"{_basePath}/{course.Settings.Name}";
|
||||
if (!Directory.Exists(courseDirectory))
|
||||
@@ -103,6 +103,7 @@ public class MarkdownCourseSaver
|
||||
|
||||
var filePath = assignmentsDirectory + "/" + assignment.Name + ".md";
|
||||
await File.WriteAllTextAsync(filePath, assignmentMarkdown);
|
||||
Console.WriteLine("saving file");
|
||||
}
|
||||
removeOldAssignments(assignmentsDirectory, module);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user