Skip to content
Snippets Groups Projects
Commit 2d942474 authored by Janis Daniel Dähne's avatar Janis Daniel Dähne
Browse files

- fixed issue with hidden template files (were not replaced for testing)

parent c2d30ec7
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,8 @@ namespace ClientServer.Helpers
/// <param name="solutionWithFiles">the solution with template files loaded</param>
/// <param name="codeTemplate">the correct code template (same plang id as solution) with loaded template files</param>
/// <param name="applyTemplateFileVisibilityResetToEmpty">true: to apply template content visibility and set the content to the template string</param>
/// <param name="applyTemplateFileVisibilityResetToTemplateContent">true: to apply template content and reset the content to the template content (only applied when applyTemplateFileVisibilityResetToEmpty is false)</param>
/// <param name="applyTemplateFileVisibilityResetToTemplateContent">true: to apply template content and reset the content to the template content (only applied when applyTemplateFileVisibilityResetToEmpty is false)
/// (this has higher priority tahn applyTemplateFileVisibilityResetToEmpty!)</param>
/// <returns></returns>
public static string ReplaceReadonlyFiles(Solution solutionWithFiles, CodeTemplate codeTemplate,
bool applyTemplateFileVisibilityResetToEmpty, bool applyTemplateFileVisibilityResetToTemplateContent)
......@@ -44,13 +45,24 @@ namespace ClientServer.Helpers
$"for solution with userId: {solutionWithFiles.UserId}, releaseId: {solutionWithFiles.ExerciseReleaseId}, plangId: {solutionWithFiles.PLangId}";
}
//we need this for testing because the user could have an old (own) version of the file
//because we changed from visible to hidden (and the user changed the file)
//for testing we want to use the template content now not the old user version
if (applyTemplateFileVisibilityResetToTemplateContent &&
templateFile.IsContentVisibleForUser == false)
{
solutionFile.Content = templateFile.Content;
solutionFile.FileNameWithExtension = templateFile.FileNameWithExtension;
continue;
}
if (applyTemplateFileVisibilityResetToEmpty && templateFile.IsContentVisibleForUser == false)
{
solutionFile.Content = "";
solutionFile.FileNameWithExtension = templateFile.FileNameWithExtension;
continue;
}
if (templateFile.IsEditableByUser) continue;
//else replace content
......@@ -69,7 +81,8 @@ namespace ClientServer.Helpers
/// <param name="solutionWithFiles"></param>
/// <param name="codeTemplate"></param>
/// <param name="applyTemplateFileVisibilityResetToEmpty">true: to apply template content visibility and set the content to the template string</param>
/// <param name="applyTemplateFileVisibilityResetToTemplateContent">true: to apply template content and reset the content to the template content (only applied when applyTemplateFileVisibilityResetToEmpty is false)</param>
/// <param name="applyTemplateFileVisibilityResetToTemplateContent">true: to apply template content and reset the content to the template content (only applied when applyTemplateFileVisibilityResetToEmpty is false)
/// (this has higher priority tahn applyTemplateFileVisibilityResetToEmpty!)</param>
/// <returns></returns>
public static string ReplaceReadonlyFiles(AfterSolution solutionWithFiles, CodeTemplate codeTemplate,
bool applyTemplateFileVisibilityResetToEmpty, bool applyTemplateFileVisibilityResetToTemplateContent)
......@@ -94,13 +107,6 @@ namespace ClientServer.Helpers
$"for solution with userId: {solutionWithFiles.SolutionUserId}, releaseId: {solutionWithFiles.SolutionExerciseReleaseId}, plangId: {solutionWithFiles.SolutionPLangId}";
}
if (applyTemplateFileVisibilityResetToEmpty && templateFile.IsContentVisibleForUser == false)
{
solutionFile.Content = "";
solutionFile.FileNameWithExtension = templateFile.FileNameWithExtension;
continue;
}
//we need this for testing because the user could have an old (own) version of the file
//because we changed from visible to hidden (and the user changed the file)
//for testing we want to use the template content now not the old user version
......@@ -111,6 +117,14 @@ namespace ClientServer.Helpers
solutionFile.FileNameWithExtension = templateFile.FileNameWithExtension;
continue;
}
if (applyTemplateFileVisibilityResetToEmpty && templateFile.IsContentVisibleForUser == false)
{
solutionFile.Content = "";
solutionFile.FileNameWithExtension = templateFile.FileNameWithExtension;
continue;
}
if (templateFile.IsEditableByUser) continue;
//else replace content
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment