Skip to content

Commit 4041cf5

Browse files
committed
TD-5155 Fixes storing of always show description value
1 parent b494abc commit 4041cf5

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ bool zeroBased
130130

131131
IEnumerable<FrameworkCompetency> GetAllCompetenciesForAdminId(string name, int adminId);
132132

133-
int InsertCompetency(string name, string? description, int adminId);
133+
int InsertCompetency(string name, string? description, int adminId, bool alwaysShowDescription = false);
134134

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

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

@@ -618,7 +618,7 @@ FROM [FrameworkCompetencyGroups]
618618
return existingId;
619619
}
620620

621-
public int InsertCompetency(string name, string? description, int adminId)
621+
public int InsertCompetency(string name, string? description, int adminId, bool alwaysShowDescription = false)
622622
{
623623
if ((name.Length == 0) | (adminId < 1))
624624
{
@@ -630,10 +630,10 @@ public int InsertCompetency(string name, string? description, int adminId)
630630
description = (description?.Trim() == "" ? null : description);
631631

632632
var existingId = connection.QuerySingle<int>(
633-
@"INSERT INTO Competencies ([Name], [Description], UpdatedByAdminID)
633+
@"INSERT INTO Competencies ([Name], [Description], UpdatedByAdminID, AlwaysShowDescription)
634634
OUTPUT INSERTED.Id
635-
VALUES (@name, @description, @adminId)",
636-
new { name, description, adminId }
635+
VALUES (@name, @description, @adminId, @alwaysShowDescription)",
636+
new { name, description, adminId, alwaysShowDescription }
637637
);
638638

639639
return existingId;
@@ -644,7 +644,6 @@ public int InsertFrameworkCompetency(
644644
int? frameworkCompetencyGroupID,
645645
int adminId,
646646
int frameworkId,
647-
bool alwaysShowDescription = false,
648647
bool addDefaultQuestions = true
649648
)
650649
{

DigitalLearningSolutions.Web/Services/FrameworkService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ 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, bool addDefaultQuestions = true);
123+
int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool addDefaultQuestions = true);
124124

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

127-
int InsertCompetency(string name, string? description, int adminId);
127+
int InsertCompetency(string name, string? description, int adminId, bool alwaysShowDescription = false);
128128

129129
int InsertFrameworkCompetencyGroup(int groupId, int frameworkID, int adminId);
130130

@@ -594,19 +594,19 @@ public int InsertComment(int frameworkId, int adminId, string comment, int? repl
594594
return frameworkDataService.InsertComment(frameworkId, adminId, comment, replyToCommentId);
595595
}
596596

597-
public int InsertCompetency(string name, string? description, int adminId)
597+
public int InsertCompetency(string name, string? description, int adminId, bool alwaysShowDescription = false)
598598
{
599-
return frameworkDataService.InsertCompetency(name, description, adminId);
599+
return frameworkDataService.InsertCompetency(name, description, adminId, alwaysShowDescription);
600600
}
601601

602602
public int InsertCompetencyGroup(string groupName, string? groupDescription, int adminId, int? frameworkId)
603603
{
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, bool addDefaultQuestions = true)
607+
public int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId, bool addDefaultQuestions = true)
608608
{
609-
return frameworkDataService.InsertFrameworkCompetency(competencyId, frameworkCompetencyGroupID, adminId, frameworkId, alwaysShowDescription, addDefaultQuestions);
609+
return frameworkDataService.InsertFrameworkCompetency(competencyId, frameworkCompetencyGroupID, adminId, frameworkId, addDefaultQuestions);
610610
}
611611

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

DigitalLearningSolutions.Web/Services/ImportCompetenciesFromFileService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ CompetencyTableRow competencyRow
211211
else
212212
{
213213
//Check if competency already exists in framework competency group and add if not
214-
newCompetencyId = frameworkService.InsertCompetency(competencyRow.Competency, competencyRow.CompetencyDescription, adminId);
214+
newCompetencyId = frameworkService.InsertCompetency(competencyRow.Competency, competencyRow.CompetencyDescription, adminId, competencyRow.AlwaysShowDescription ?? false);
215215
if (newCompetencyId > 0)
216216
{
217-
newFrameworkCompetencyId = frameworkService.InsertFrameworkCompetency(newCompetencyId, frameworkCompetencyGroupId, adminId, frameworkId, competencyRow.AlwaysShowDescription ?? false, false); //including always show desc flag
217+
newFrameworkCompetencyId = frameworkService.InsertFrameworkCompetency(newCompetencyId, frameworkCompetencyGroupId, adminId, frameworkId, false);
218218
if (newFrameworkCompetencyId > maxFrameworkCompetencyId)
219219
{
220220
competencyRow.RowStatus = (competencyRow.RowStatus == RowStatus.CompetencyGroupInserted ? RowStatus.CompetencyGroupAndCompetencyInserted : RowStatus.CompetencyInserted);

0 commit comments

Comments
 (0)