Skip to content

Commit 860066a

Browse files
committed
Update FrameworkDataService.cs
1 parent ce7e4fb commit 860066a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using DigitalLearningSolutions.Data.Models.Common;
99
using DigitalLearningSolutions.Data.Models.Email;
1010
using DigitalLearningSolutions.Data.Models.Frameworks;
11+
using DigitalLearningSolutions.Data.Models.Frameworks.Import;
1112
using DigitalLearningSolutions.Data.Models.SelfAssessments;
1213
using Microsoft.Extensions.Logging;
1314
using AssessmentQuestion = DigitalLearningSolutions.Data.Models.Frameworks.AssessmentQuestion;
@@ -98,6 +99,7 @@ bool zeroBased
9899
);
99100

100101
Competency? GetFrameworkCompetencyForPreview(int frameworkCompetencyId);
102+
IEnumerable<BulkCompetency> GetBulkCompetenciesForFramework(int frameworkId);
101103

102104
// Comments:
103105
IEnumerable<CommentReplies> GetCommentsForFrameworkId(int frameworkId, int adminId);
@@ -2396,5 +2398,22 @@ FROM FrameworkDefaultQuestions
23962398
new { competencyId, frameworkId }
23972399
);
23982400
}
2401+
2402+
public IEnumerable<BulkCompetency> GetBulkCompetenciesForFramework(int frameworkId)
2403+
{
2404+
return connection.Query<BulkCompetency>(
2405+
@"SELECT fc.ID, cg.Name AS CompetencyGroup, cg.Description AS GroupDescription, c.Name AS Competency, c.Description AS CompetencyDescription, c.AlwaysShowDescription, STRING_AGG(f.FlagName, ', ') AS FlagsCsv
2406+
FROM Flags AS f RIGHT OUTER JOIN
2407+
CompetencyFlags AS cf ON f.ID = cf.FlagID RIGHT OUTER JOIN
2408+
Competencies AS c INNER JOIN
2409+
FrameworkCompetencies AS fc ON c.ID = fc.CompetencyID INNER JOIN
2410+
FrameworkCompetencyGroups AS fcg ON fc.FrameworkCompetencyGroupID = fcg.ID INNER JOIN
2411+
CompetencyGroups AS cg ON fcg.CompetencyGroupID = cg.ID ON cf.CompetencyID = c.ID
2412+
WHERE (fc.FrameworkID = @frameworkId)
2413+
GROUP BY fc.ID, cg.Name, cg.Description, c.Name, c.Description, c.AlwaysShowDescription, fcg.Ordering, fc.Ordering
2414+
ORDER BY fcg.Ordering, fc.Ordering",
2415+
new { frameworkId }
2416+
);
2417+
}
23992418
}
24002419
}

0 commit comments

Comments
 (0)