Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
75d3633
Bump webpack from 5.90.3 to 5.94.0 in /DigitalLearningSolutions.Web
dependabot[bot] Sep 5, 2024
67f6053
Bump micromatch from 4.0.5 to 4.0.8 in /DigitalLearningSolutions.Web
dependabot[bot] Sep 9, 2024
56e3913
Bump braces from 3.0.2 to 3.0.3 in /DigitalLearningSolutions.Web
dependabot[bot] Sep 9, 2024
3a8ce1c
Bump Microsoft.Data.SqlClient in /DigitalLearningSolutions.Data.Tests
dependabot[bot] Sep 9, 2024
c333cf0
Bump dompurify from 2.4.7 to 2.5.4 in /DigitalLearningSolutions.Web
dependabot[bot] Sep 16, 2024
01259c3
Squashed commit of the following:
kevwhitt-hee Nov 25, 2024
d9c9b6b
Removes migration causing an error in production data during deployment
kevwhitt-hee Nov 27, 2024
49d6df1
Merge branch 'master' into DLS-Release-v1.1.0
kevwhitt-hee Nov 27, 2024
0a24e3a
TD-4973 Limit the list of supervisors in the Request proficiency conf…
sherif-olaboye Nov 27, 2024
3c09df3
TD-4889 Resolving internal server error when nominating delegate to s…
sherif-olaboye Nov 27, 2024
fbeaa0a
TD-4889 Resolving internal server error when nominating delegate to s…
sherif-olaboye Nov 27, 2024
2d83b17
Create auto-merge.yml
binon Nov 29, 2024
79a7cc2
Merge pull request #2983 from TechnologyEnhancedLearning/master
binon Nov 29, 2024
dc5201c
Bump eslint-plugin-import in /DigitalLearningSolutions.Web (#2985)
dependabot[bot] Nov 29, 2024
7ca7306
Bump NUnit3TestAdapter from 4.5.0 to 4.6.0 (#2988)
dependabot[bot] Nov 29, 2024
23e3623
Bump core-js from 3.36.0 to 3.39.0 in /DigitalLearningSolutions.Web (…
dependabot[bot] Nov 29, 2024
2e76e69
Bump eslint-plugin-jasmine in /DigitalLearningSolutions.Web (#2986)
dependabot[bot] Nov 29, 2024
fbdb983
Bump rimraf from 5.0.5 to 5.0.10 in /DigitalLearningSolutions.Web (#2…
dependabot[bot] Nov 29, 2024
4bb395b
Bump babel-loader from 9.1.3 to 9.2.1 in /DigitalLearningSolutions.We…
dependabot[bot] Nov 29, 2024
f645616
Bump xunit from 2.6.2 to 2.9.2 (#2993)
dependabot[bot] Nov 29, 2024
59628e7
Bump Dapper from 2.1.24 to 2.1.35 (#2995)
dependabot[bot] Nov 29, 2024
d816ad8
Bump Selenium.Support and Selenium.WebDriver
dependabot[bot] Nov 29, 2024
96230a9
Bump Microsoft.Data.SqlClient from 5.1.5 to 5.2.2 (#2992)
dependabot[bot] Nov 29, 2024
a8e74f6
Merge branch 'Automatic_version_update_dependabot' into dependabot/np…
binon Nov 29, 2024
f32d515
Merge branch 'Automatic_version_update_dependabot' into dependabot/np…
binon Nov 29, 2024
32bcbb4
Merge branch 'Automatic_version_update_dependabot' into dependabot/np…
binon Nov 29, 2024
cec3d75
Merge pull request #2991 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
5f304d6
Merge pull request #2829 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
1311590
Merge branch 'Automatic_version_update_dependabot' into dependabot/np…
binon Nov 29, 2024
85585fc
Bump HtmlAgilityPack from 1.11.54 to 1.11.71
dependabot[bot] Nov 29, 2024
135c740
Bump Selenium.Axe and Selenium.WebDriver
dependabot[bot] Nov 29, 2024
f9b3a60
Upgraded the SqlClient manulaly to 5.2.2
binon Nov 29, 2024
db6eecb
Merge pull request #2826 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
45ee60a
Merge pull request #2819 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
81e9d14
Merge pull request #2997 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
6405248
Bump Microsoft.AspNetCore.Mvc.Testing from 6.0.25 to 7.0.0
dependabot[bot] Nov 29, 2024
767807a
Merge pull request #2840 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
3aa6c7c
Merge branch 'Automatic_version_update_dependabot' into dependabot/nu…
binon Nov 29, 2024
faf17c7
Merge pull request #2996 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
7e30e2c
Merge branch 'Automatic_version_update_dependabot' into dependabot/np…
binon Nov 29, 2024
2a8ec3b
Bump nhsuk-frontend from 6.1.0 to 6.2.0 in /DigitalLearningSolutions.…
dependabot[bot] Nov 29, 2024
be597de
Bump eslint-plugin-jasmine in /DigitalLearningSolutions.Web (#3000)
dependabot[bot] Nov 29, 2024
9d58071
Bump input-range-scss in /DigitalLearningSolutions.Web (#3006)
dependabot[bot] Nov 29, 2024
10eb243
Merge pull request #2828 from TechnologyEnhancedLearning/dependabot/n…
binon Nov 29, 2024
ada5b3a
Bump @typescript-eslint/eslint-plugin in /DigitalLearningSolutions.We…
dependabot[bot] Nov 29, 2024
7111af2
Bump regenerator-runtime in /DigitalLearningSolutions.Web (#3002)
dependabot[bot] Nov 29, 2024
9ac23c0
Upgraded FluentMigrator and its dependencies manually
binon Nov 29, 2024
11c4522
TD-4787- Changed role from Educator/Manager to Assessor for nominated…
Auldrin-Possa Dec 2, 2024
a375ec9
Merge pull request #2980 from TechnologyEnhancedLearning/Develop/Feat…
kevwhitt-hee Dec 3, 2024
b31b0f1
Merge pull request #2981 from TechnologyEnhancedLearning/Develop/Feat…
kevwhitt-hee Dec 3, 2024
7a1b148
Merge pull request #2998 from TechnologyEnhancedLearning/dependabot/n…
kevwhitt-hee Dec 3, 2024
8fcc378
Merge pull request #3011 from TechnologyEnhancedLearning/Automatic_ve…
kevwhitt-hee Dec 3, 2024
399189b
TD-5095-SupervisorDelegateId check added along with CandidateAssessme…
Auldrin-Possa Dec 3, 2024
9cb7184
Merge pull request #3009 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Dec 6, 2024
7949fa8
Merge pull request #3014 from TechnologyEnhancedLearning/Develop/Fix/…
kevwhitt-hee Dec 6, 2024
592898b
TD-4884 Prevent supervisors from confirm self assessments in a catego…
sherif-olaboye Dec 9, 2024
6b8006c
Merge remote-tracking branch 'origin/DLS-Release-v1.1.0' into Develop…
sherif-olaboye Dec 13, 2024
1f61456
TD-4884 Running of autoformatter to remove odd whitespace
sherif-olaboye Dec 13, 2024
c01bc93
TD-5026 Removing selfassessment that does not belong to course catego…
sherif-olaboye Dec 16, 2024
e7ee824
Merge pull request #3020 from TechnologyEnhancedLearning/Develop/Feat…
kevwhitt-hee Dec 17, 2024
b0f7863
Merge pull request #3026 from TechnologyEnhancedLearning/Develop/Feat…
kevwhitt-hee Dec 17, 2024
ce7e4fb
TD-5153 Implements page changes and starts to implement download actions
kevwhitt-hee Dec 19, 2024
869a1f0
Merge branch 'DLS-Release-v1.1.0' into DLS-Release-v1.1.1
kevwhitt-hee Dec 19, 2024
860066a
Update FrameworkDataService.cs
kevwhitt-hee Dec 19, 2024
ec0350d
Resolving merge problem
kevwhitt-hee Dec 19, 2024
28f843b
Resolving merge problem
kevwhitt-hee Dec 19, 2024
bc83b0d
Merge branch 'DLS-Release-v1.1.1' into Develop/Features/TD-5153-BulkU…
kevwhitt-hee Dec 19, 2024
ac16f0f
TD-5153 Implements download competencies and templates functions and …
kevwhitt-hee Dec 20, 2024
fd7550c
Update ImportCompleted.cshtml
kevwhitt-hee Dec 20, 2024
897a1e5
Implements models for handling upload
kevwhitt-hee Dec 20, 2024
a3f80e9
Formatter changes
kevwhitt-hee Dec 20, 2024
5c0a6c1
Fixes form input id
kevwhitt-hee Dec 20, 2024
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,36 @@
namespace DigitalLearningSolutions.Data.Migrations
{
using FluentMigrator;

[Migration(202412020900)]
public class UpdateCandidateAssessmentSupervisorsTable : 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
-- to exclude duplicate CandidateAssessmentID from update
AND cas.CandidateAssessmentID NOT IN (
SELECT CandidateAssessmentID FROM CandidateAssessmentSupervisors WHERE CandidateAssessmentID in (
SELECT Cas2.CandidateAssessmentID
FROM CandidateAssessmentSupervisors cas2 with (nolock) INNER JOIN
SelfAssessmentSupervisorRoles ssr2 with (nolock) ON cas2.SelfAssessmentSupervisorRoleID = ssr2.ID
AND cas2.Removed IS NULL AND ssr2.AllowDelegateNomination = 0 INNER JOIN
SupervisorDelegates sd2 with (nolock) ON cas2.SupervisorDelegateId = sd2.ID INNER JOIN
AdminAccounts aa2 with (nolock) ON sd2.SupervisorAdminID = aa2.ID
WHERE aa2.IsSupervisor = 0 AND aa2.IsNominatedSupervisor = 1
)
GROUP BY CandidateAssessmentID,SupervisorDelegateId
HAVING COUNT(*)>1
)"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ LEFT OUTER JOIN UserCentreDetails AS UCD ON
new { candidateAssessmentId, enrolmentMethodId, completeByDateDynamic }
);
}
if (candidateAssessmentId > 1 && supervisorDelegateId !=0)
if (candidateAssessmentId > 1 && supervisorDelegateId != 0)
{
string sqlQuery = $@"
BEGIN TRANSACTION
Expand All @@ -551,17 +551,17 @@ BEGIN TRANSACTION

UPDATE CandidateAssessmentSupervisors SET Removed = NULL
{((selfAssessmentSupervisorRoleId > 0) ? " ,SelfAssessmentSupervisorRoleID = @selfAssessmentSupervisorRoleID" : string.Empty)}
WHERE CandidateAssessmentID = @candidateAssessmentId
WHERE CandidateAssessmentID = @candidateAssessmentId AND SupervisorDelegateId = @supervisorDelegateId

COMMIT TRANSACTION";

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

if (supervisorId > 0)
{

var adminUserId = Convert.ToInt32(connection.ExecuteScalar(@"SELECT UserID FROM AdminAccounts WHERE (AdminAccounts.ID = @supervisorId)",
new { supervisorId })
);
Expand Down
29 changes: 29 additions & 0 deletions DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using DigitalLearningSolutions.Data.Models.Common;
using DigitalLearningSolutions.Data.Models.Email;
using DigitalLearningSolutions.Data.Models.Frameworks;
using DigitalLearningSolutions.Data.Models.Frameworks.Import;
using DigitalLearningSolutions.Data.Models.SelfAssessments;
using Microsoft.Extensions.Logging;
using AssessmentQuestion = DigitalLearningSolutions.Data.Models.Frameworks.AssessmentQuestion;
Expand Down Expand Up @@ -98,6 +99,7 @@ bool zeroBased
);

Competency? GetFrameworkCompetencyForPreview(int frameworkCompetencyId);
IEnumerable<BulkCompetency> GetBulkCompetenciesForFramework(int frameworkId);

// Comments:
IEnumerable<CommentReplies> GetCommentsForFrameworkId(int frameworkId, int adminId);
Expand Down Expand Up @@ -2396,5 +2398,32 @@ FROM FrameworkDefaultQuestions
new { competencyId, frameworkId }
);
}

public IEnumerable<BulkCompetency> GetBulkCompetenciesForFramework(int frameworkId)
{
if (frameworkId < 1)
{
return connection.Query<BulkCompetency>(
@"SELECT NULL AS ID, '' AS CompetencyGroup, '' AS GroupDescription, '' AS Competency, '' AS CompetencyDescription, NULL AS AlwaysShowDescription, '' AS FlagsCsv"
);
}
else
{
return connection.Query<BulkCompetency>(
@"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
FROM Flags AS f RIGHT OUTER JOIN
CompetencyFlags AS cf ON f.ID = cf.FlagID RIGHT OUTER JOIN
Competencies AS c INNER JOIN
FrameworkCompetencies AS fc ON c.ID = fc.CompetencyID INNER JOIN
FrameworkCompetencyGroups AS fcg ON fc.FrameworkCompetencyGroupID = fcg.ID INNER JOIN
CompetencyGroups AS cg ON fcg.CompetencyGroupID = cg.ID ON cf.CompetencyID = c.ID
WHERE (fc.FrameworkID = @frameworkId)
GROUP BY fc.ID, cg.Name, cg.Description, c.Name, c.Description, c.AlwaysShowDescription, fcg.Ordering, fc.Ordering
ORDER BY fcg.Ordering, fc.Ordering",
new { frameworkId }
);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public partial class SelfAssessmentDataService
{
public IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int delegateUserId, int centreId, int? adminCategoryId)
public IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int delegateUserId, int centreId, int? adminIdCategoryID)
{
return connection.Query<CurrentSelfAssessment>(
@"SELECT SelfAssessment.Id,
Expand Down Expand Up @@ -67,7 +67,8 @@ Competencies AS C RIGHT OUTER JOIN
CandidateAssessmentSupervisorVerifications AS casv ON casv.CandidateAssessmentSupervisorID = cas.ID LEFT OUTER JOIN
AdminAccounts AS aaEnrolledBy ON aaEnrolledBy.ID = CA.EnrolledByAdminID LEFT OUTER JOIN
Users AS uEnrolledBy ON uEnrolledBy.ID = aaEnrolledBy.UserID
WHERE (CA.DelegateUserID = @delegateUserId) AND (CA.RemovedDate IS NULL) AND (CA.CompletedDate IS NULL) AND (ISNULL(@adminCategoryId, 0) = 0 OR sa.CategoryID = @adminCategoryId)
WHERE (CA.DelegateUserID = @delegateUserId) AND (CA.RemovedDate IS NULL) AND (CA.CompletedDate IS NULL)
AND (ISNULL(@adminIdCategoryID, 0) = 0 OR sa.CategoryID = @adminIdCategoryId)
GROUP BY
CA.SelfAssessmentID, SA.Name, SA.Description, SA.IncludesSignposting, SA.SupervisorResultsReview,
SA.ReviewerCommentsLabel, SA.IncludeRequirementsFilters,
Expand All @@ -83,10 +84,87 @@ CandidateAssessments AS CA LEFT OUTER JOIN
(casv.Verified IS NOT NULL)
GROUP BY SelfAssessmentID,casv.SignedOff
)Signoff ON SelfAssessment.Id =Signoff.SelfAssessmentID",
new { delegateUserId, centreId, adminCategoryId }
new { delegateUserId, centreId, adminIdCategoryID }
);
}
public IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int delegateUserId, int centreId)
{
return connection.Query<CurrentSelfAssessment>(
@"SELECT SelfAssessment.Id,
SelfAssessment.Name,
SelfAssessment.Description,
SelfAssessment.IncludesSignposting,
SelfAssessment.IncludeRequirementsFilters,
SelfAssessment. IsSupervisorResultsReviewed,
SelfAssessment.ReviewerCommentsLabel,
SelfAssessment. Vocabulary,
SelfAssessment. NumberOfCompetencies,
SelfAssessment.StartedDate,
SelfAssessment.LastAccessed,
SelfAssessment.CompleteByDate,
SelfAssessment.CandidateAssessmentId,
SelfAssessment.UserBookmark,
SelfAssessment.UnprocessedUpdates,
SelfAssessment.LaunchCount,
SelfAssessment. IsSelfAssessment,
SelfAssessment.SubmittedDate,
SelfAssessment. CentreName,
SelfAssessment.EnrolmentMethodId,
Signoff.SignedOff,
Signoff.Verified,
EnrolledByForename +' '+EnrolledBySurname AS EnrolledByFullName
FROM (SELECT
CA.SelfAssessmentID AS Id,
SA.Name,
SA.Description,
SA.IncludesSignposting,
SA.IncludeRequirementsFilters,
SA.SupervisorResultsReview AS IsSupervisorResultsReviewed,
SA.ReviewerCommentsLabel,
COALESCE(SA.Vocabulary, 'Capability') AS Vocabulary,
COUNT(C.ID) AS NumberOfCompetencies,
CA.StartedDate,
CA.LastAccessed,
CA.CompleteByDate,
CA.ID AS CandidateAssessmentId,
CA.UserBookmark,
CA.UnprocessedUpdates,
CA.LaunchCount,
1 AS IsSelfAssessment,
CA.SubmittedDate,
CR.CentreName AS CentreName,
CA.EnrolmentMethodId,
uEnrolledBy.FirstName AS EnrolledByForename,
uEnrolledBy.LastName AS EnrolledBySurname
FROM Centres AS CR INNER JOIN
CandidateAssessments AS CA INNER JOIN
SelfAssessments AS SA ON CA.SelfAssessmentID = SA.ID ON CR.CentreID = CA.CentreID INNER JOIN
CentreSelfAssessments AS csa ON csa.SelfAssessmentID = SA.ID AND csa.CentreID = @centreId LEFT OUTER JOIN
Competencies AS C RIGHT OUTER JOIN
SelfAssessmentStructure AS SAS ON C.ID = SAS.CompetencyID ON CA.SelfAssessmentID = SAS.SelfAssessmentID LEFT OUTER JOIN
CandidateAssessmentSupervisors AS cas ON ca.ID =cas.CandidateAssessmentID LEFT OUTER JOIN
CandidateAssessmentSupervisorVerifications AS casv ON casv.CandidateAssessmentSupervisorID = cas.ID LEFT OUTER JOIN
AdminAccounts AS aaEnrolledBy ON aaEnrolledBy.ID = CA.EnrolledByAdminID LEFT OUTER JOIN
Users AS uEnrolledBy ON uEnrolledBy.ID = aaEnrolledBy.UserID
WHERE (CA.DelegateUserID = @delegateUserId) AND (CA.RemovedDate IS NULL) AND (CA.CompletedDate IS NULL)
GROUP BY
CA.SelfAssessmentID, SA.Name, SA.Description, SA.IncludesSignposting, SA.SupervisorResultsReview,
SA.ReviewerCommentsLabel, SA.IncludeRequirementsFilters,
COALESCE(SA.Vocabulary, 'Capability'), CA.StartedDate, CA.LastAccessed, CA.CompleteByDate,
CA.ID,
CA.UserBookmark, CA.UnprocessedUpdates, CA.LaunchCount, CA.SubmittedDate, CR.CentreName,CA.EnrolmentMethodId,
uEnrolledBy.FirstName,uEnrolledBy.LastName)SelfAssessment LEFT OUTER JOIN
(SELECT SelfAssessmentID,casv.SignedOff,MAX(casv.Verified) Verified FROM
CandidateAssessments AS CA LEFT OUTER JOIN
CandidateAssessmentSupervisors AS cas ON ca.ID =cas.CandidateAssessmentID LEFT OUTER JOIN
CandidateAssessmentSupervisorVerifications AS casv ON casv.CandidateAssessmentSupervisorID = cas.ID
WHERE (CA.DelegateUserID = @delegateUserId) AND (CA.RemovedDate IS NULL) AND (CA.CompletedDate IS NULL) AND (casv.SignedOff = 1) AND
(casv.Verified IS NOT NULL)
GROUP BY SelfAssessmentID,casv.SignedOff
)Signoff ON SelfAssessment.Id =Signoff.SelfAssessmentID",
new { delegateUserId, centreId }
);
}

public CurrentSelfAssessment? GetSelfAssessmentForCandidateById(int delegateUserId, int selfAssessmentId)
{
return connection.QueryFirstOrDefault<CurrentSelfAssessment>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ int competencyId

// CandidateAssessmentsDataService

IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int delegateUserId, int centreId, int? adminCategoryId);

IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int delegateUserId, int centreId, int? adminIdCategoryID);
IEnumerable<CurrentSelfAssessment> GetSelfAssessmentsForCandidate(int delegateUserId, int centreId);
CurrentSelfAssessment? GetSelfAssessmentForCandidateById(int delegateUserId, int selfAssessmentId);

void UpdateLastAccessed(int selfAssessmentId, int delegateUserId);
Expand Down Expand Up @@ -174,7 +174,6 @@ int GetSelfAssessmentActivityDelegatesExportCount(string searchString, string so
bool HasMinimumOptionalCompetencies(int selfAssessmentId, int delegateUserId);
int GetSelfAssessmentCategoryId(int selfAssessmentId);
}

public partial class SelfAssessmentDataService : ISelfAssessmentDataService
{
private readonly IDbConnection connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface ISupervisorDataService
DelegateSelfAssessment? GetSelfAssessmentByCandidateAssessmentId(int candidateAssessmentId, int adminId, int? adminIdCategoryId);
IEnumerable<SupervisorDashboardToDoItem> GetSupervisorDashboardToDoItemsForRequestedSignOffs(int adminId);
IEnumerable<SupervisorDashboardToDoItem> GetSupervisorDashboardToDoItemsForRequestedReviews(int adminId);
DelegateSelfAssessment? GetSelfAssessmentBaseByCandidateAssessmentId(int candidateAssessmentId);
DelegateSelfAssessment? GetSelfAssessmentBaseByCandidateAssessmentId(int candidateAssessmentId, int? adminIdCategoryId);
IEnumerable<RoleProfile> GetAvailableRoleProfilesForDelegate(int candidateId, int centreId, int? categoryId);
RoleProfile? GetRoleProfileById(int selfAssessmentId);
IEnumerable<SelfAssessmentSupervisorRole> GetSupervisorRolesForSelfAssessment(int selfAssessmentId);
Expand Down Expand Up @@ -594,7 +594,7 @@ FROM CandidateAssessmentSupervisors AS cas INNER JOIN
WHERE (ca.RemovedDate IS NULL) AND (cas.SupervisorDelegateId = @supervisorDelegateId) AND (cas.Removed IS NULL) AND (sa.ID = @selfAssessmentId)", new { selfAssessmentId, supervisorDelegateId }
).FirstOrDefault();
}
public DelegateSelfAssessment? GetSelfAssessmentBaseByCandidateAssessmentId(int candidateAssessmentId)
public DelegateSelfAssessment? GetSelfAssessmentBaseByCandidateAssessmentId(int candidateAssessmentId, int? adminIdCategoryId)
{
return connection.Query<DelegateSelfAssessment>(
@$"SELECT ca.ID, sa.ID AS SelfAssessmentID, sa.Name AS RoleName, sa.QuestionLabel, sa.DescriptionLabel, sa.ReviewerCommentsLabel,
Expand All @@ -611,7 +611,7 @@ FROM SelfAssessmentResultSupervisorVerifications AS sarsv
FROM CandidateAssessmentSupervisors AS cas INNER JOIN
CandidateAssessments AS ca ON cas.CandidateAssessmentID = ca.ID INNER JOIN
SelfAssessments AS sa ON sa.ID = ca.SelfAssessmentID
WHERE (ca.ID = @candidateAssessmentId)", new { candidateAssessmentId }
WHERE (ca.ID = @candidateAssessmentId) AND (ISNULL(@adminIdCategoryID, 0) = 0 OR sa.CategoryID = @adminIdCategoryId)", new { candidateAssessmentId, adminIdCategoryId }
).FirstOrDefault();
}
public DelegateSelfAssessment? GetSelfAssessmentBySupervisorDelegateCandidateAssessmentId(int candidateAssessmentId, int supervisorDelegateId)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DigitalLearningSolutions.Data.Models.Frameworks.Import
{
public class BulkCompetency
{
public int? id { get; set; }
public string? CompetencyGroup { get; set; }
public string? GroupDescription { get; set; }
public string? Competency { get; set; }
public string? CompetencyDescription { get; set; }
public bool? AlwaysShowDescription { get; set; }
public string? FlagsCsv { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
namespace DigitalLearningSolutions.Data.Models.Frameworks.Import
{
using ClosedXML.Excel;
using System;
using System.Collections.Generic;
using System.Text;
public enum RowStatus
{
NotYetProcessed,
Skipped,
CompetencyGroupInserted,
CompetencyGroupAndCompetencyInserted,
CompetencyInserted
CompetencyInserted,
CompetencyUpdated,
CompetencyGroupInserted,
CompetencyGroupUpdated,
CompetencyGroupAndCompetencyUpdated
}
public class CompetencyTableRow
public class CompetencyTableRow : BulkCompetency
{
public CompetencyTableRow(IXLTable table, IXLRangeRow row)
{
Expand All @@ -23,28 +23,28 @@ public CompetencyTableRow(IXLTable table, IXLRangeRow row)
}

RowNumber = row.RowNumber();
CompetencyGroupName = FindFieldValue("competency group");
CompetencyName = FindFieldValue("competency name");
CompetencyDescription = FindFieldValue("competency description");
id = int.Parse(FindFieldValue("ID"));
CompetencyGroup = FindFieldValue("CompetencyGroup");
Competency = FindFieldValue("Competency");
CompetencyDescription = FindFieldValue("CompetencyDescription");
GroupDescription = FindFieldValue("CompetencyGroupDescription");
FlagsCsv = FindFieldValue("FlagsCSV");
RowStatus = RowStatus.NotYetProcessed;
}
public int RowNumber { get; set; }
public string? CompetencyGroupName { get; set; }
public string? CompetencyName { get; set; }
public string? CompetencyDescription { get; set; }
public ImportCompetenciesResult.ErrorReason? Error { get; set; }
public RowStatus RowStatus { get; set; }
public bool Validate()
{
if (string.IsNullOrEmpty(CompetencyName))
if (string.IsNullOrEmpty(Competency))
{
Error = ImportCompetenciesResult.ErrorReason.MissingCompetencyName;
}
else if (CompetencyGroupName?.Length > 255)
else if (CompetencyGroup?.Length > 255)
{
Error = ImportCompetenciesResult.ErrorReason.TooLongCompetencyGroupName;
}
else if (CompetencyName.Length > 500)
else if (Competency.Length > 500)
{
Error = ImportCompetenciesResult.ErrorReason.TooLongCompetencyName;
}
Expand Down
Loading
Loading