File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed
DigitalLearningSolutions.Data/DataServices
DigitalLearningSolutions.Web
Views/Frameworks/Developer/Import Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ bool zeroBased
100100
101101 Competency ? GetFrameworkCompetencyForPreview ( int frameworkCompetencyId ) ;
102102 IEnumerable < BulkCompetency > GetBulkCompetenciesForFramework ( int frameworkId ) ;
103+ List < int > GetFrameworkCompetencyOrder ( int frameworkId , List < int > frameworkCompetencyIds ) ;
103104
104105 // Comments:
105106 IEnumerable < CommentReplies > GetCommentsForFrameworkId ( int frameworkId , int adminId ) ;
@@ -2429,5 +2430,16 @@ Competencies AS c INNER JOIN
24292430 }
24302431
24312432 }
2433+ public List < int > GetFrameworkCompetencyOrder ( int frameworkId , List < int > frameworkCompetencyIds )
2434+ {
2435+ return connection . Query < int > (
2436+ @"SELECT fc.ID
2437+ FROM FrameworkCompetencies AS fc INNER JOIN
2438+ FrameworkCompetencyGroups AS fcg ON fc.FrameworkCompetencyGroupID = fcg.ID
2439+ WHERE (fc.FrameworkID = @frameworkId) AND (fc.ID IN @frameworkCompetencyIds)
2440+ ORDER BY fcg.Ordering, fc.Ordering" ,
2441+ new { frameworkId , frameworkCompetencyIds }
2442+ ) . ToList ( ) ;
2443+ }
24322444 }
24332445}
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ public interface IFrameworkService
5757
5858 int GetMaxFrameworkCompetencyGroupID ( ) ;
5959 IEnumerable < BulkCompetency > GetBulkCompetenciesForFramework ( int frameworkId ) ;
60+ List < int > GetFrameworkCompetencyOrder ( int frameworkId , List < int > frameworkCompetencyIds ) ;
6061
6162 // Assessment questions:
6263 IEnumerable < AssessmentQuestion > GetAllCompetencyQuestions ( int adminId ) ;
@@ -386,6 +387,11 @@ public IEnumerable<BulkCompetency> GetBulkCompetenciesForFramework(int framework
386387 return frameworkDataService . GetBulkCompetenciesForFramework ( frameworkId ) ;
387388 }
388389
390+ public List < int > GetFrameworkCompetencyOrder ( int frameworkId , List < int > frameworkCompetencyIds )
391+ {
392+ return frameworkDataService . GetFrameworkCompetencyOrder ( frameworkId , frameworkCompetencyIds ) ;
393+ }
394+
389395 public CollaboratorNotification ? GetCollaboratorNotification ( int id , int invitedByAdminId )
390396 {
391397 return frameworkDataService . GetCollaboratorNotification ( id , invitedByAdminId ) ;
Original file line number Diff line number Diff line change @@ -35,8 +35,7 @@ public ImportCompetenciesResult PreProcessCompetenciesTable(IXLWorkbook workbook
3535 var table = OpenCompetenciesTable ( workbook , vocabulary ) ;
3636 var competencyRows = table . Rows ( ) . Skip ( 1 ) . Select ( row => new CompetencyTableRow ( table , row ) ) . ToList ( ) ;
3737 var newCompetencyIds = competencyRows . Select ( row => row . ID ?? 0 ) . ToList ( ) ;
38- var existingCompetencies = frameworkService . GetBulkCompetenciesForFramework ( frameworkId ) ;
39- var existingIds = existingCompetencies . Select ( bc => ( int ) bc . ID ) . ToList ( ) ;
38+ var existingIds = frameworkService . GetFrameworkCompetencyOrder ( frameworkId , newCompetencyIds ) ;
4039 foreach ( var competencyRow in competencyRows )
4140 {
4241 PreProcessCompetencyRow ( competencyRow , newCompetencyIds , existingIds ) ;
Original file line number Diff line number Diff line change 5959 }
6060 else
6161 {
62- <p class =" nhsuk-body-l" >Check the information below . You will need fix these errors before continuing or remove the rows with errors from your spreadsheet : </p >
62+ <p class =" nhsuk-body-l" >Check the information below . You will need to fix these errors before continuing or remove the rows with errors from your spreadsheet : </p >
6363 <div class =" nhsuk-form-group nhsuk-form-group--error" >
6464 <span class =" nhsuk-error-message" id =" error-list" >
6565 <span class =" nhsuk-u-visually-hidden" >Error : </span > @Model.ErrorCount @Model.FrameworkVocabularySingular.ToLower() @( Model .ErrorCount == 1 ? " row" : " rows" ) contain errors and cannot be processed
You can’t perform that action at this time.
0 commit comments