Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
d8afbf3
TD-4881 Limit the supervisor My Staff view self assessment counts to …
sherif-olaboye Oct 29, 2024
9541ce3
TD-4879 Limit the self assessments returned in Delegate Activities by…
sherif-olaboye Oct 24, 2024
4888394
TD-4879 Limit the self assessments returned in Delegate Activities by…
sherif-olaboye Oct 24, 2024
7c9d551
TD-4882-RoleProfiles retrieved based on logged in supervisor category
Auldrin-Possa Oct 25, 2024
9a9d8d4
TD-4878-Retrieved supervisor list based on Category ID
Auldrin-Possa Oct 24, 2024
a0f0e38
TD-4883- Returning self-assessments for a supervisor delegate based o…
Auldrin-Possa Oct 29, 2024
e0aff2d
TD-4887- SQL query modified to return supervisors based on self-asses…
Auldrin-Possa Oct 29, 2024
96c68e0
TD-4887-code optimized
Auldrin-Possa Oct 30, 2024
4543229
TD-4888-Removed unused parameter 'centreId' from the service method
Auldrin-Possa Oct 30, 2024
739c903
TD-4972-added comparison of supervisor CategoryID with self-assessmen…
Auldrin-Possa Oct 30, 2024
bfe87ba
Update pull_request_template.md
kevwhitt-hee Oct 31, 2024
5e43819
TD-4974-Sign off supervisors list filtered based on category
Auldrin-Possa Oct 31, 2024
7082f24
TD-4975-Todo items for requested signoffs/confirmation are filtered b…
Auldrin-Possa Nov 1, 2024
0b10f11
TD-4889 When a supervisor promotes a learner to the Nominated supervi…
sherif-olaboye Nov 4, 2024
d2986d4
TD-4973 Limit the list of supervisors in the Request proficiency conf…
sherif-olaboye Nov 5, 2024
fdc3bb6
TD-4884 Prevent supervisors from viewing/reviewing self assessments i…
sherif-olaboye Nov 6, 2024
3e6af30
TD-4884 Resolved git build error
sherif-olaboye Nov 6, 2024
4194dc8
TD-5020 Resolving build failure
rshrirohit Nov 7, 2024
4503194
TD-4880- Prevent administrators from viewing Activity Delegates for s…
ABSinhaa Nov 7, 2024
92cda8b
TD-4880- undoing Sherif's change for the task TD-4879 since it was su…
ABSinhaa Nov 8, 2024
8103c34
Update Resources.Designer.cs
kevwhitt-hee Nov 15, 2024
c2a1560
Restoring changes lost during branch rebase
kevwhitt-hee Nov 15, 2024
9e94be8
Update SupervisorControllerTests.cs
kevwhitt-hee Nov 15, 2024
eb32c1f
TD-4169 - Sql query modified to get current/non-deleted framework col…
Auldrin-Possa Nov 18, 2024
7a74b0a
TD-4340 Issue with the 'Course content' change link when creating a c…
sherif-olaboye Nov 19, 2024
724bbb1
TD-5019- Removed the hyperlink from the breadcrumb text 'Manage Center'
Auldrin-Possa Nov 19, 2024
60e861c
TD-4395 'Enrolled' field label needs to change to 'First enrolled' sa…
sherif-olaboye Nov 21, 2024
e4c2e2a
TD-4406- Added check if admin account exists.
Auldrin-Possa Nov 21, 2024
52654f9
Merge pull request #2951 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Nov 21, 2024
203ed0e
Merge pull request #2954 from TechnologyEnhancedLearning/Develop/Fixe…
kevwhitt-hee Nov 21, 2024
74338b4
Merge pull request #2959 from TechnologyEnhancedLearning/Develop/Fixe…
kevwhitt-hee Nov 22, 2024
f2ea7f4
Merge pull request #2962 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Nov 22, 2024
8d451b4
Merge pull request #2955 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Nov 22, 2024
4f1576f
Merge branch 'DLS-Release-v1.1.0' into DLS-Release-v1.1.1
kevwhitt-hee Nov 22, 2024
980b9c7
Update Supervisor.cs
kevwhitt-hee Nov 22, 2024
199f8b5
TD-5028 Supervise - Remove staff member doesn't remove the supervisor…
sherif-olaboye Nov 22, 2024
db6d722
TD-4405- used comment prompt if exists.
Auldrin-Possa Nov 25, 2024
6e844cc
TD-4893 Delegate activities - view course delegates resulted in 500 e…
sherif-olaboye Nov 26, 2024
4a6a427
TD-4893 Delegate activities - view course delegates resulted in 500 e…
sherif-olaboye Nov 26, 2024
6488711
Merge branch 'master' into DLS-Release-v1.1.1
kevwhitt-hee Nov 27, 2024
3c52b9d
TD-4372- Changed order of checking existing accounts.
Auldrin-Possa Nov 28, 2024
7f179fd
Merge pull request #2969 from TechnologyEnhancedLearning/Develop/Fixe…
kevwhitt-hee Nov 29, 2024
99a3bb9
Merge pull request #2973 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Nov 29, 2024
ac3b7ca
Merge remote-tracking branch 'origin/DLS-Release-v1.1.1' into Develop…
sherif-olaboye Dec 2, 2024
70c2531
TD-4893 Delegate activities - view course delegates resulted in 500 e…
sherif-olaboye Dec 2, 2024
eafb99b
TD-4893 Delegate activities - view course delegates resulted in 500 e…
sherif-olaboye Dec 2, 2024
198b222
TD-4893 Delegate activities - view course delegates resulted in 500 e…
sherif-olaboye Dec 2, 2024
b8e3b43
TD-4893 Remove filter duplicate
sherif-olaboye Dec 2, 2024
ef382c3
Squashed commit of the following:
kevwhitt-hee Dec 3, 2024
01bde99
TD-4893 Replacing the FilterSeparator
sherif-olaboye Dec 3, 2024
45a1b37
TD-5026 limit the self assessments in the manage delegate section bas…
ABSinhaa Dec 3, 2024
8be64c1
Merge pull request #2974 from TechnologyEnhancedLearning/Develop/Fixe…
kevwhitt-hee Dec 6, 2024
77f1dd1
Merge pull request #2982 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Dec 6, 2024
4b0e1f9
Merge pull request #3015 from TechnologyEnhancedLearning/Develop/fixe…
kevwhitt-hee Dec 6, 2024
8ecfa96
TD-5108-Added action filter to restrict access
Auldrin-Possa Dec 10, 2024
df24eb8
TD-5084 Self-assessments Sign off should not be allowed through URL m…
sherif-olaboye Dec 11, 2024
6d6b222
Merge pull request #3022 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Dec 13, 2024
fa509b9
Merge pull request #3023 from TechnologyEnhancedLearning/Develop/Fixe…
kevwhitt-hee Dec 13, 2024
869a1f0
Merge branch 'DLS-Release-v1.1.0' into DLS-Release-v1.1.1
kevwhitt-hee Dec 19, 2024
ec0350d
Resolving merge problem
kevwhitt-hee Dec 19, 2024
28f843b
Resolving merge problem
kevwhitt-hee Dec 19, 2024
76359f0
TD-5131 Self-assessment Manage Supervisor still displays the Supervis…
sherif-olaboye Dec 19, 2024
e25a178
TD-5135-Universal fix implemented for handling non-matching stored fi…
auldrinpossa Dec 19, 2024
2e192df
TD-5180-Added verification if sign-off rejected.
auldrinpossa Dec 24, 2024
f7fcb4d
Merge pull request #3033 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Dec 30, 2024
9ed1154
Merge pull request #3034 from TechnologyEnhancedLearning/Develop/feat…
rshrirohit Dec 30, 2024
a2a2d61
Merge branch 'DLS-Release-v1.1.0' into DLS-Release-v1.1.1
rshrirohit Dec 30, 2024
16c7fba
Merge branch 'master' into DLS-Release-v1.1.1
rshrirohit Jan 9, 2025
3f0ec0d
TD-5096 Hide the link to the DSAT report if the admin user is in a ca…
sherif-olaboye Jan 9, 2025
5f899dd
TD-4340 Issue with the 'Course content' change link when creating a c…
sherif-olaboye Jan 13, 2025
99482e1
TD-4340 Issue with the 'Course content' change link when creating a c…
sherif-olaboye Jan 13, 2025
276b11c
TD-5131 ‘Request Educator/Manager sign off' screen and can be able to…
sherif-olaboye Jan 15, 2025
752b4dd
TD-5028 Supervise - Remove staff member doesn't remove the supervisor…
sherif-olaboye Jan 16, 2025
441d4ae
Merge pull request #3038 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Jan 20, 2025
79a5e4a
Merge pull request #3062 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Jan 21, 2025
215bd20
Merge pull request #3063 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Jan 21, 2025
ec55a05
TD-4435 Mismatch of 'Enrolment method' showing on 'Tracking system' &…
sherif-olaboye Jan 21, 2025
b116823
Merge pull request #3060 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Jan 23, 2025
d363e89
Merge pull request #3069 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Jan 23, 2025
c64dfb3
TD-5138_ Staff count was incorrect on the dashboard and doesn't match…
ABSinhaa Jan 23, 2025
316357f
TD-4405-Displays the CommentsPrompt label if it exists
Auldrin-Possa Jan 23, 2025
fc35590
Merge pull request #3056 from TechnologyEnhancedLearning/Develop/Feat…
rshrirohit Jan 27, 2025
7a6cbfd
Merge pull request #3075 from TechnologyEnhancedLearning/Develop/fixe…
rshrirohit Jan 27, 2025
40cfeb7
Merge pull request #3076 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Jan 27, 2025
1bd0203
TD-5242-Added 'Inactive' label when admin is inactive.
Auldrin-Possa Jan 27, 2025
4eaef7a
TD-5265 Issue showing 'confirmation requests/confirm self assessments…
sherif-olaboye Jan 28, 2025
a51a950
Merge pull request #3088 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Jan 28, 2025
58b567b
TD-4169 Framework Contributor Permission Not Working
rshrirohit Jan 28, 2025
d6a5f00
TD-5242-verified if delegate account is active
Auldrin-Possa Jan 29, 2025
a20cd7a
TD-4169 Correcting the condition for Getting Roles
rshrirohit Jan 30, 2025
034e137
Merge pull request #3093 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Jan 30, 2025
b1438be
Merge pull request #3094 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Jan 30, 2025
5fd814c
TD-4169 Corrected wrong AdminID in FrameworkCollaborators Table
rshrirohit Jan 30, 2025
3c7168b
TD 4169 Run the formatter
rshrirohit Jan 30, 2025
bff182c
Merge pull request #3097 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Jan 31, 2025
cf0bc77
Merge pull request #3089 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Feb 3, 2025
a0382c0
TD-5329 Moves fwc.isdeleted to join instead of where clause to ensure…
kevwhitt-hee Feb 3, 2025
24625b6
TD-5288 Correcting YML files To Point To DOTNET8
rshrirohit Feb 6, 2025
0bc5eab
Merge pull request #3116 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

namespace DigitalLearningSolutions.Data.Migrations
{
using FluentMigrator;

[Migration(202410071401)]
public class UpdateCandidateAssessmentSupervisorsTabl : ForwardOnlyMigration
{
public override void Up()
{
Execute.Sql($@"UPDATE cas
SET SelfAssessmentSupervisorRoleID = (SELECT ID FROM SelfAssessmentSupervisorRoles
WHERE SelfAssessmentID = ssr.SelfAssessmentID and AllowDelegateNomination = 1)
FROM CandidateAssessmentSupervisors cas INNER JOIN
SelfAssessmentSupervisorRoles ssr ON cas.SelfAssessmentSupervisorRoleID = ssr.ID
AND cas.Removed IS NULL AND ssr.AllowDelegateNomination = 0 INNER JOIN
SupervisorDelegates sd ON cas.SupervisorDelegateId = sd.ID INNER JOIN
AdminAccounts aa ON sd.SupervisorAdminID = aa.ID WHERE aa.IsSupervisor = 0 AND aa.IsNominatedSupervisor = 1");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,13 @@
<data name="TD_4950_Alter_GetAssessmentResultsByDelegate_UP" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD_4950_Alter_GetAssessmentResultsByDelegate_UP.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="TD-4950-dboGetOtherCentresForSelfAssessmentCreateOrAlter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TD-4950-dboGetOtherCentresForSelfAssessmentCreateOrAlter.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="TD_4878_Alter_GetActivitiesForDelegateEnrolment_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD-4878-Alter_GetActivitiesForDelegateEnrolment_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="TD_4878_Alter_GetActivitiesForDelegateEnrolment_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD-4878-Alter_GetActivitiesForDelegateEnrolment_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
</root>
12 changes: 6 additions & 6 deletions DigitalLearningSolutions.Data/DataServices/CourseDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int EnrolOnActivitySelfAssessment(int selfAssessmentId, int candidateId, int sup
public IEnumerable<DelegateAssessmentStatistics> GetDelegateAssessmentStatisticsAtCentre(string searchString, int centreId, string categoryName, string isActive, int? categoryId);

bool IsSelfEnrollmentAllowed(int customisationId);
Customisation? GetCourse(int customisationId);
Customisation? GetCourse(int? customisationId);
}

public class CourseDataService : ICourseDataService
Expand Down Expand Up @@ -537,16 +537,16 @@ LEFT OUTER JOIN UserCentreDetails AS UCD ON
if (candidateAssessmentId > 1 && supervisorDelegateId == 0)
{
connection.Execute(
@"UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic
@"UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic, EnrolledByAdminId = @enrolledByAdminId
WHERE ID = @candidateAssessmentId",
new { candidateAssessmentId, enrolmentMethodId, completeByDateDynamic }
new { candidateAssessmentId, enrolmentMethodId, completeByDateDynamic, enrolledByAdminId }
);
}
if (candidateAssessmentId > 1 && supervisorDelegateId != 0)
{
string sqlQuery = $@"
BEGIN TRANSACTION
UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic
UPDATE CandidateAssessments SET RemovedDate = NULL, EnrolmentMethodId = @enrolmentMethodId, CompleteByDate = @completeByDateDynamic, EnrolledByAdminId = @enrolledByAdminId
WHERE ID = @candidateAssessmentId

UPDATE CandidateAssessmentSupervisors SET Removed = NULL
Expand All @@ -556,7 +556,7 @@ BEGIN TRANSACTION
COMMIT TRANSACTION";

connection.Execute(sqlQuery
, new { candidateAssessmentId, selfAssessmentSupervisorRoleId, enrolmentMethodId, completeByDateDynamic, supervisorDelegateId });
, new { candidateAssessmentId, selfAssessmentSupervisorRoleId, enrolmentMethodId, completeByDateDynamic, supervisorDelegateId, enrolledByAdminId });
}

if (supervisorId > 0)
Expand Down Expand Up @@ -2024,7 +2024,7 @@ public bool IsSelfEnrollmentAllowed(int customisationId)
return selfRegister > 0;
}

public Customisation? GetCourse(int customisationId)
public Customisation? GetCourse(int? customisationId)
{
return connection.Query<Customisation>(
@"SELECT CustomisationID
Expand Down
20 changes: 10 additions & 10 deletions DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool zeroBased

int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId);

int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify);
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID);
void AddCustomFlagToFramework(int frameworkId, string flagName, string flagGroup, string flagTagClass);
void UpdateFrameworkCustomFlag(int frameworkId, int id, string flagName, string flagGroup, string flagTagClass);

Expand Down Expand Up @@ -299,7 +299,7 @@ FROM CourseTopics

private const string FrameworkTables =
@"Frameworks AS FW LEFT OUTER JOIN
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId AND COALESCE(IsDeleted, 0) = 0
LEFT OUTER JOIN FrameworkReviews AS fwr ON fwc.ID = fwr.FrameworkCollaboratorID AND fwr.Archived IS NULL AND fwr.ReviewComplete IS NULL";

private const string AssessmentQuestionFields =
Expand Down Expand Up @@ -751,7 +751,7 @@ FROM FrameworkCollaborators fc
);
}

public int AddCollaboratorToFramework(int frameworkId, string? userEmail, bool canModify)
public int AddCollaboratorToFramework(int frameworkId, string? userEmail, bool canModify, int? centreID)
{
if (userEmail is null || userEmail.Length == 0)
{
Expand All @@ -774,8 +774,8 @@ FROM FrameworkCollaborators
}

var adminId = (int?)connection.ExecuteScalar(
@"SELECT AdminID FROM AdminUsers WHERE Email = @userEmail AND Active = 1",
new { userEmail }
@"SELECT AdminID FROM AdminUsers WHERE Email = @userEmail AND Active = 1 AND CentreID = @centreID",
new { userEmail, centreID }
);
if (adminId is null)
{
Expand Down Expand Up @@ -1823,11 +1823,11 @@ FROM Competencies AS C INNER JOIN

public int GetAdminUserRoleForFrameworkId(int adminId, int frameworkId)
{
return (int)connection.ExecuteScalar(
@"SELECT CASE WHEN FW.OwnerAdminID = @adminId THEN 3 WHEN fwc.CanModify = 1 THEN 2 WHEN fwc.CanModify = 0 THEN 1 ELSE 0 END AS UserRole
FROM Frameworks AS FW LEFT OUTER JOIN
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId
WHERE FW.ID = @frameworkId",
return connection.QuerySingle<int>(
@"SELECT CASE WHEN FW.OwnerAdminID = @adminId THEN 3 WHEN COALESCE (fwc.CanModify, 0) = 1 THEN 2 WHEN COALESCE (fwc.CanModify, 0) = 0 THEN 1 ELSE 0 END AS UserRole
FROM Frameworks AS FW LEFT OUTER JOIN
FrameworkCollaborators AS fwc ON fwc.FrameworkID = FW.ID AND fwc.AdminID = @adminId AND fwc.IsDeleted = 0
WHERE (FW.ID = @frameworkId)",
new { adminId, frameworkId }
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,41 @@ FROM SelfAssessmentResults
);
}

public IEnumerable<SelfAssessmentResult> GetSelfAssessmentResultswithSupervisorVerificationsForDelegateSelfAssessmentCompetency(
int delegateUserId,
int selfAssessmentId,
int competencyId
)
{
return connection.Query<SelfAssessmentResult>(
@"SELECT
s.ID,
s.SelfAssessmentID,
s.CompetencyID,
s.AssessmentQuestionID,
s.Result,
s.DateTime,
s.SupportingComments,
s.DelegateUserId
FROM SelfAssessmentResults s inner join
SelfAssessmentResultSupervisorVerifications sv ON s.ID = sv.SelfAssessmentResultId AND sv.Superceded = 0
WHERE s.CompetencyID = @competencyId
AND s.SelfAssessmentID = @selfAssessmentId
AND s.DelegateUserID = @delegateUserId",
new { selfAssessmentId, delegateUserId, competencyId }
);
}

public void RemoveReviewCandidateAssessmentOptionalCompetencies(int id)
{

connection.Execute(@"UPDATE SelfAssessmentResults SET Result = NULL WHERE ID = @id", new { id});

connection.Execute(
@"delete from SelfAssessmentResultSupervisorVerifications WHERE SelfAssessmentResultId = @id", new { id });

}

private static string PrintResult(
int competencyId,
int selfAssessmentId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ int GetSelfAssessmentActivityDelegatesExportCount(string searchString, string so
bool IsCentreSelfAssessment(int selfAssessmentId, int centreId);
bool HasMinimumOptionalCompetencies(int selfAssessmentId, int delegateUserId);
int GetSelfAssessmentCategoryId(int selfAssessmentId);
void RemoveReviewCandidateAssessmentOptionalCompetencies(int id);
public IEnumerable<SelfAssessmentResult> GetSelfAssessmentResultswithSupervisorVerificationsForDelegateSelfAssessmentCompetency(
int delegateUserId,
int selfAssessmentId,
int competencyId
);
}
public partial class SelfAssessmentDataService : ISelfAssessmentDataService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int delegateUserId
return connection.Query<SelfAssessmentSupervisor>(
@$"{SelectSelfAssessmentSupervisorQuery}
WHERE (sd.Removed IS NULL) AND (cas.Removed IS NULL) AND (ca.DelegateUserID = @delegateUserId)
AND (ca.SelfAssessmentID = @selfAssessmentId)
AND (ca.SelfAssessmentID = @selfAssessmentId) AND (au.Supervisor = 1 or au.NominatedSupervisor = 1)
AND (au.CategoryID = 0 OR au.CategoryID IN (select CategoryID from SelfAssessments where ID = @selfAssessmentId))
ORDER BY SupervisorName",
new { selfAssessmentId, delegateUserId }
Expand All @@ -95,7 +95,7 @@ int delegateUserId
WHERE (sd.Removed IS NULL) AND (cas.Removed IS NULL) AND (sd.DelegateUserID = @delegateUserId)
AND (ca.SelfAssessmentID = @selfAssessmentId) AND (sd.SupervisorAdminID IS NOT NULL)
AND (coalesce(sasr.ResultsReview, 1) = 1)
AND au.Active = 1
AND au.Active = 1 AND (au.Supervisor = 1 or au.NominatedSupervisor = 1)
AND (au.CategoryID = 0 OR au.CategoryID IN (select CategoryID from SelfAssessments where ID = @selfAssessmentId))
ORDER BY SupervisorName",
new { selfAssessmentId, delegateUserId }
Expand Down Expand Up @@ -153,7 +153,7 @@ int delegateUserId
WHERE (sd.Removed IS NULL) AND (cas.Removed IS NULL) AND (sd.DelegateUserID = @delegateUserId) AND (ca.SelfAssessmentID = @selfAssessmentId)
AND (sd.SupervisorAdminID IS NOT NULL) AND (coalesce(sasr.SelfAssessmentReview, 1) = 1)
AND (cas.ID NOT IN (SELECT CandidateAssessmentSupervisorID FROM CandidateAssessmentSupervisorVerifications WHERE Verified IS NULL))
AND au.Active = 1
AND au.Active = 1 AND (au.Supervisor = 1 or au.NominatedSupervisor = 1)
AND (au.CategoryID = 0 OR au.CategoryID IN (select CategoryID from SelfAssessments where ID = @selfAssessmentId))
ORDER BY SupervisorName",
new { selfAssessmentId, delegateUserId }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,35 @@ public SupervisorDataService(IDbConnection connection, ILogger<SupervisorDataSer
public DashboardData? GetDashboardDataForAdminId(int adminId)
{
return connection.Query<DashboardData>(
@" SELECT (SELECT COUNT(sd.ID) AS StaffCount
FROM SupervisorDelegates sd
LEFT OUTER JOIN users u
ON u.id = sd.DelegateUserID
AND u.Active = 1
WHERE (sd.SupervisorAdminID = @adminId)
AND (sd.Removed IS NULL)) AS StaffCount,
@"SELECT (SELECT COUNT(sd.ID) AS StaffCount
FROM CustomPrompts AS cp6
RIGHT OUTER JOIN CustomPrompts AS cp5
RIGHT OUTER JOIN DelegateAccounts AS da
RIGHT OUTER JOIN SupervisorDelegates AS sd
INNER JOIN AdminUsers AS au
ON sd.SupervisorAdminID = au.AdminID
INNER JOIN Centres AS ct
ON au.CentreID = ct.CentreID
ON da.CentreID = ct.CentreID
AND da.UserID = sd.DelegateUserID
LEFT OUTER JOIN Users AS u
LEFT OUTER JOIN JobGroups AS jg
ON u.JobGroupID = jg.JobGroupID
ON da.UserID = u.ID
LEFT OUTER JOIN CustomPrompts AS cp1
ON ct.CustomField1PromptID = cp1.CustomPromptID
LEFT OUTER JOIN CustomPrompts AS cp2
ON ct.CustomField2PromptID = cp2.CustomPromptID
LEFT OUTER JOIN CustomPrompts AS cp3
ON ct.CustomField3PromptID = cp3.CustomPromptID
LEFT OUTER JOIN CustomPrompts AS cp4
ON ct.CustomField4PromptID = cp4.CustomPromptID
ON cp5.CustomPromptID = ct.CustomField5PromptID
ON cp6.CustomPromptID = ct.CustomField6PromptID
LEFT OUTER JOIN AdminAccounts AS au2
ON da.UserID = au2.UserID AND da.CentreID = au2.CentreID
WHERE (sd.SupervisorAdminID = @adminId) AND (sd.Removed IS NULL) AND
(u.ID = da.UserID OR sd.DelegateUserID IS NULL)) AS StaffCount,
(SELECT COUNT(ID) AS StaffCount
FROM SupervisorDelegates AS SupervisorDelegates_1
WHERE (SupervisorAdminID = @adminId)
Expand Down
Loading
Loading