Skip to content

Commit b494abc

Browse files
committed
TD-5155 Fixes framework default questions always added issue
1 parent 9bc9bde commit b494abc

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ bool zeroBased
132132

133133
int InsertCompetency(string name, string? description, int adminId);
134134

135-
int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool alwaysShowDescription = false);
135+
int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool alwaysShowDescription = false, bool addDefaultQuestions = true);
136136

137137
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID);
138138

@@ -644,7 +644,8 @@ public int InsertFrameworkCompetency(
644644
int? frameworkCompetencyGroupID,
645645
int adminId,
646646
int frameworkId,
647-
bool alwaysShowDescription = false
647+
bool alwaysShowDescription = false,
648+
bool addDefaultQuestions = true
648649
)
649650
{
650651
if ((competencyId < 1) | (adminId < 1) | (frameworkId < 1))
@@ -706,8 +707,10 @@ FROM [FrameworkCompetencies]
706707
new { competencyId, frameworkCompetencyGroupID }
707708
);
708709
}
709-
710-
AddDefaultQuestionsToCompetency(competencyId, frameworkId);
710+
if(addDefaultQuestions)
711+
{
712+
AddDefaultQuestionsToCompetency(competencyId, frameworkId);
713+
}
711714
return existingId;
712715
}
713716

DigitalLearningSolutions.Web/Controllers/FrameworksController/ImportCompetencies.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,6 @@ public IActionResult ImportSummarySubmit()
261261
var workbook = new XLWorkbook(filePath);
262262
var results = importCompetenciesFromFileService.ProcessCompetenciesFromFile(workbook, adminId, data.FrameworkId, data.FrameworkVocubulary, data.ReorderCompetenciesOption, data.AddAssessmentQuestionsOption, data.AddCustomAssessmentQuestion ? (int)data.CustomAssessmentQuestionID : 0, data.AddDefaultAssessmentQuestions ? data.DefaultQuestionIDs : []);
263263
data.ImportCompetenciesResult = results;
264-
//TO DO apply ordering changes if required:
265-
if (data.ReorderCompetenciesOption == 2 && data.CompetenciesToReorderCount > 0)
266-
{
267-
268-
}
269264
setBulkUploadData(data);
270265
return RedirectToAction("UploadResults", "Frameworks", new { frameworkId = data.FrameworkId, tabname = data.TabName });
271266
}

DigitalLearningSolutions.Web/Services/FrameworkService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ bool zeroBased
120120

121121
int InsertCompetencyGroup(string groupName, string? groupDescription, int adminId, int? frameworkId = null);
122122

123-
int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool alwaysShowDescription = false);
123+
int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool alwaysShowDescription = false, bool addDefaultQuestions = true);
124124

125125
IEnumerable<FrameworkCompetency> GetAllCompetenciesForAdminId(string name, int adminId);
126126

@@ -604,9 +604,9 @@ public int InsertCompetencyGroup(string groupName, string? groupDescription, int
604604
return frameworkDataService.InsertCompetencyGroup(groupName, groupDescription, adminId, frameworkId);
605605
}
606606

607-
public int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool alwaysShowDescription = false)
607+
public int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool alwaysShowDescription = false, bool addDefaultQuestions = true)
608608
{
609-
return frameworkDataService.InsertFrameworkCompetency(competencyId, frameworkCompetencyGroupID, adminId, frameworkId, alwaysShowDescription);
609+
return frameworkDataService.InsertFrameworkCompetency(competencyId, frameworkCompetencyGroupID, adminId, frameworkId, alwaysShowDescription, addDefaultQuestions);
610610
}
611611

612612
public int InsertFrameworkCompetencyGroup(int groupId, int frameworkID, int adminId)

DigitalLearningSolutions.Web/Services/ImportCompetenciesFromFileService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ CompetencyTableRow competencyRow
214214
newCompetencyId = frameworkService.InsertCompetency(competencyRow.Competency, competencyRow.CompetencyDescription, adminId);
215215
if (newCompetencyId > 0)
216216
{
217-
newFrameworkCompetencyId = frameworkService.InsertFrameworkCompetency(newCompetencyId, frameworkCompetencyGroupId, adminId, frameworkId, competencyRow.AlwaysShowDescription ?? false); //including always show desc flag
217+
newFrameworkCompetencyId = frameworkService.InsertFrameworkCompetency(newCompetencyId, frameworkCompetencyGroupId, adminId, frameworkId, competencyRow.AlwaysShowDescription ?? false, false); //including always show desc flag
218218
if (newFrameworkCompetencyId > maxFrameworkCompetencyId)
219219
{
220220
competencyRow.RowStatus = (competencyRow.RowStatus == RowStatus.CompetencyGroupInserted ? RowStatus.CompetencyGroupAndCompetencyInserted : RowStatus.CompetencyInserted);

0 commit comments

Comments
 (0)