|
8 | 8 | using DigitalLearningSolutions.Data.Models.Common; |
9 | 9 | using DigitalLearningSolutions.Data.Models.Email; |
10 | 10 | using DigitalLearningSolutions.Data.Models.Frameworks; |
| 11 | + using DigitalLearningSolutions.Data.Models.Frameworks.Import; |
11 | 12 | using DigitalLearningSolutions.Data.Models.SelfAssessments; |
12 | 13 | using Microsoft.Extensions.Logging; |
13 | 14 | using AssessmentQuestion = DigitalLearningSolutions.Data.Models.Frameworks.AssessmentQuestion; |
@@ -98,6 +99,7 @@ bool zeroBased |
98 | 99 | ); |
99 | 100 |
|
100 | 101 | Competency? GetFrameworkCompetencyForPreview(int frameworkCompetencyId); |
| 102 | + IEnumerable<BulkCompetency> GetBulkCompetenciesForFramework(int frameworkId); |
101 | 103 |
|
102 | 104 | // Comments: |
103 | 105 | IEnumerable<CommentReplies> GetCommentsForFrameworkId(int frameworkId, int adminId); |
@@ -2396,5 +2398,22 @@ FROM FrameworkDefaultQuestions |
2396 | 2398 | new { competencyId, frameworkId } |
2397 | 2399 | ); |
2398 | 2400 | } |
| 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 | + } |
2399 | 2418 | } |
2400 | 2419 | } |
0 commit comments