@@ -59,6 +59,15 @@ int categoryId
5959 bool UpdateOptionalCompetenciesTaskStatus ( int assessmentId , bool taskStatus , bool ? previousStatus ) ;
6060 bool UpdateRoleRequirementsTaskStatus ( int assessmentId , bool taskStatus , bool ? previousStatus ) ;
6161 bool UpdateWorkingGroupTaskStatus ( int assessmentId , bool taskStatus , bool ? previousStatus ) ;
62+ bool UpdateCompetencyAssessmentOptions (
63+ bool includeLearnerDeclarationPrompt ,
64+ bool includesSignposting ,
65+ bool linearNavigation ,
66+ bool useDescriptionExpanders ,
67+ string ? questionLabelText ,
68+ string ? reviewerCommentsLabelText ,
69+ int competencyAssessmentId , int adminId ) ;
70+ bool UpdateCompetencyAssessmentOptionsTaskStatus ( int assessmentId , bool taskStatus ) ;
6271 void MoveCompetencyInSelfAssessment ( int competencyAssessmentId ,
6372 int competencyId ,
6473 string direction
@@ -93,6 +102,7 @@ bool UpdateSelfAssessments(int competencyAssessmentId,
93102 int AddCollaboratorToCompetencyAssessment ( int competencyAssessmentId , string ? userEmail , bool canModify , int ? centreID ) ;
94103 void RemoveCollaboratorFromCompetencyAssessment ( int competencyAssessmentId , int id ) ;
95104 CompetencyAssessmentCollaboratorNotification ? GetCollaboratorNotification ( int id , int invitedByAdminId ) ;
105+ bool HasCompetencyWithSignpostedLearning ( int competencyAssessmentId ) ;
96106 }
97107
98108 public class CompetencyAssessmentDataService : ICompetencyAssessmentDataService
@@ -109,6 +119,8 @@ public class CompetencyAssessmentDataService : ICompetencyAssessmentDataService
109119 sa.SupervisorSelfAssessmentReview,
110120 sa.SignOffSupervisorStatement,
111121 sa.SignOffRequestorStatement" ;
122+ sa . IncludeLearnerDeclarationPrompt , sa . IncludesSignposting , sa . LinearNavigation , sa . UseDescriptionExpanders , sa . QuestionLabel , sa . ReviewerCommentsLabel ,
123+ sa . SupervisorSelfAssessmentReview , sa . SupervisorResultsReview ";
112124
113125 private const string SelfAssessmentFields =
114126 @", sa.CategoryID, sa.CreatedDate,
@@ -390,7 +402,7 @@ WHERE NOT EXISTS (SELECT 1 FROM SelfAssessmentFrameworks WHERE SelfAssessmentId
390402 {
391403 numberOfAffectedRows = connection . Execute (
392404 @"UPDATE SelfAssessmentFrameworks
393- SET RemovedDate = NULL, RemovedByAdminId = NULL, AmendedByAdminId = @adminId
405+ SET RemovedDate = NULL, RemovedByAdminId = NULL, AmendedByAdminId = @adminId, IsPrimary = 0
394406 WHERE SelfAssessmentId = @selfAssessmentId AND FrameworkId = @frameworkId"
395407 ,
396408 new { adminId , selfAssessmentId , frameworkId }
@@ -1136,6 +1148,80 @@ UPDATE SelfAssessments
11361148 $ "competencyAssessmentId: { competencyAssessmentId } , supervised: { supervised } " +
11371149 $ "signoff: { signoff } , confirm: { confirm } , supervisorDeclarationValue: { supervisorDeclarationValue } " +
11381150 $ "supervisorCustomText: { supervisorCustomText } , leanerDeclarationValue: { leanerDeclarationValue } , leanerCustomText: { leanerCustomText } "
1151+
1152+ public bool HasCompetencyWithSignpostedLearning( int competencyAssessmentId )
1153+ {
1154+ int hasSignpostedLearning = connection. QueryFirstOrDefault < int > (
1155+ @"SELECT count(*) FROM SelfAssessmentStructure sas INNER JOIN
1156+ CompetencyLearningResources clr ON sas.CompetencyID = clr.CompetencyID AND
1157+ clr.RemovedDate IS NULL
1158+ WHERE sas.SelfAssessmentID = @competencyAssessmentId" ,
1159+ new { competencyAssessmentId } ) ;
1160+
1161+ return hasSignpostedLearning > 0 ;
1162+ }
1163+ public bool UpdateCompetencyAssessmentOptions (
1164+ bool includeLearnerDeclarationPrompt ,
1165+ bool includesSignposting ,
1166+ bool linearNavigation ,
1167+ bool useDescriptionExpanders ,
1168+ string ? questionLabelText ,
1169+ string ? reviewerCommentsLabelText ,
1170+ int competencyAssessmentId , int adminId )
1171+ {
1172+ if ( ( adminId < 1 ) | ( competencyAssessmentId < 1 ) )
1173+ {
1174+ logger . LogWarning (
1175+ $ "Not updating role profile name as it failed server side validation. AdminId: { adminId } , competencyAssessmentId: { competencyAssessmentId } "
1176+ ) ;
1177+ return false ;
1178+ }
1179+
1180+ var numberOfAffectedRows = connection . Execute (
1181+ @"UPDATE SelfAssessments SET IncludeLearnerDeclarationPrompt = @includeLearnerDeclarationPrompt,
1182+ IncludesSignposting = @includesSignposting,
1183+ LinearNavigation = @linearNavigation,
1184+ UseDescriptionExpanders = @useDescriptionExpanders,
1185+ QuestionLabel = @questionLabelText,
1186+ ReviewerCommentsLabel = @reviewerCommentsLabelText,
1187+ UpdatedByAdminID = @adminId
1188+ WHERE ID = @competencyAssessmentId " ,
1189+ new
1190+ {
1191+ includeLearnerDeclarationPrompt ,
1192+ includesSignposting ,
1193+ linearNavigation ,
1194+ useDescriptionExpanders ,
1195+ questionLabelText ,
1196+ reviewerCommentsLabelText ,
1197+ adminId ,
1198+ competencyAssessmentId
1199+ }
1200+ ) ;
1201+ if ( numberOfAffectedRows < 1 )
1202+ {
1203+ logger . LogWarning (
1204+ "Not updating options/labels as db update failed. " +
1205+ $ "admin id: { adminId } , competencyAssessmentId: { competencyAssessmentId } "
1206+ ) ;
1207+ return false ;
1208+ }
1209+
1210+ return true ;
1211+ }
1212+
1213+ public bool UpdateCompetencyAssessmentOptionsTaskStatus ( int assessmentId , bool taskStatus )
1214+ {
1215+ var numberOfAffectedRows = connection . Execute (
1216+ @"UPDATE SelfAssessmentTaskStatus SET SelfAssessmentOptionsTaskStatus = @taskStatus
1217+ WHERE SelfAssessmentId = @assessmentId" ,
1218+ new { assessmentId , taskStatus }
1219+ ) ;
1220+ if ( numberOfAffectedRows < 1 )
1221+ {
1222+ logger . LogWarning (
1223+ "Not updating SelfAssessmentOptionsTaskStatus as db update failed. " +
1224+ $ "assessmentId: { assessmentId } , taskStatus: { taskStatus } "
11391225 ) ;
11401226 return false ;
11411227 }
0 commit comments