Skip to content

Commit 3098eaa

Browse files
authored
Merge pull request #2893 from TechnologyEnhancedLearning/Develop/Features/TD-4751-FlagSelfAssessmentNonReportable
Mark the Non Reportable flag as true when the user Id of the delegate matches the user Id of the admin record of the supervisor being selected.
2 parents edfca62 + 3e6bbbd commit 3098eaa

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

DigitalLearningSolutions.Data/DataServices/CourseDataService.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ LEFT OUTER JOIN UserCentreDetails AS UCD ON
541541
new { candidateAssessmentId, enrolmentMethodId, completeByDateDynamic }
542542
);
543543
}
544-
if (candidateAssessmentId > 1 && supervisorDelegateId !=0)
544+
545+
if (candidateAssessmentId > 1 && supervisorDelegateId !=0)
546+
545547
{
546548
string sqlQuery = $@"
547549
BEGIN TRANSACTION
@@ -558,6 +560,23 @@ BEGIN TRANSACTION
558560
, new { candidateAssessmentId, selfAssessmentSupervisorRoleId, enrolmentMethodId, completeByDateDynamic });
559561
}
560562

563+
if (supervisorId > 0)
564+
{
565+
566+
var adminUserId = Convert.ToInt32(connection.ExecuteScalar(@"SELECT UserID FROM AdminAccounts WHERE (AdminAccounts.ID = @supervisorId)",
567+
new { supervisorId })
568+
);
569+
570+
if (delegateUserId == adminUserId)
571+
{
572+
connection.Execute(
573+
@"UPDATE CandidateAssessments SET NonReportable = 1 WHERE ID = @candidateAssessmentId",
574+
new { candidateAssessmentId }
575+
);
576+
577+
}
578+
}
579+
561580
if (candidateAssessmentId < 1)
562581
{
563582
logger.LogWarning(

0 commit comments

Comments
 (0)