Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9f585c3
TD-3711 Adding Last Accessed Columns To Tables
rshrirohit Mar 11, 2025
312ef00
TD-3712 Update LastAccessed Date For Users During Login
rshrirohit Mar 12, 2025
527973e
TD-3711 Correcting table name
rshrirohit Mar 12, 2025
52cb242
TD-3712 Correcting GetUTCDate()
rshrirohit Mar 12, 2025
13a4d51
Merge pull request #3169 from TechnologyEnhancedLearning/Develop/Feat…
rshrirohit Mar 13, 2025
b5cf544
Merge pull request #3170 from TechnologyEnhancedLearning/Develop/Feat…
rshrirohit Mar 13, 2025
66d8aed
TD-3713- Update LastAccessed Date For AdminAccounts And DelegateAccounts
rshrirohit Mar 13, 2025
01774db
TD-3713 Addressing test fail for the case when only admin account is …
rshrirohit Mar 13, 2025
be28d6d
TD-3714 Adding LastAccessed Date To Delegates Card In Tracking System
rshrirohit Mar 13, 2025
5d4dd9c
TD-3716-Adding LastAccessed Date In Admin Card
rshrirohit Mar 13, 2025
6b805b7
TD-3717 Adding LastAccessed Date In SuperAdmin UserAccounts Card
rshrirohit Mar 14, 2025
2a8b0a2
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Mar 14, 2025
1f17db2
TD-3714 Making LastAccessed date nullable in model
rshrirohit Mar 14, 2025
3407b72
Merge pull request #3173 from TechnologyEnhancedLearning/Develop/Feat…
rshrirohit Mar 14, 2025
4afde56
Merge pull request #3174 from TechnologyEnhancedLearning/Develop/Feat…
rshrirohit Mar 14, 2025
fd992ed
Merge pull request #3175 from TechnologyEnhancedLearning/Develop/Feat…
rshrirohit Mar 14, 2025
d636cb4
Merge pull request #3176 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Mar 14, 2025
94bb54b
TD-3715 Including LastAccessed Date In Delegates Export
rshrirohit Mar 14, 2025
1f0d1da
TD-3718 Adding LastAccessed Date in SuperAdmin Administrators Card
rshrirohit Mar 16, 2025
2c0a48f
Merge pull request #3183 from TechnologyEnhancedLearning/Develop/Feat…
rshrirohit Mar 17, 2025
bde0460
Merge pull request #3185 from TechnologyEnhancedLearning/Develop/Feau…
rshrirohit Mar 17, 2025
ba800b7
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Mar 17, 2025
30bebd0
TD-3719 Including LastAccessed Date In SuperAdmin Delegates Card
rshrirohit Mar 18, 2025
e086d72
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Mar 19, 2025
57df4e1
TD-5443-Added check for existing flag names prior to add or edit cust…
Auldrin-Possa Mar 20, 2025
87d3841
TD-5435-The 'To Do' section has been moved above the 'Staff' section.
Auldrin-Possa Mar 21, 2025
9c892a4
TD-5436-The 'To Do' section has been moved above the 'Frameworks' sec…
Auldrin-Possa Mar 21, 2025
a54fb43
Merge pull request #3187 from TechnologyEnhancedLearning/Develop/Fixe…
rshrirohit Mar 25, 2025
92fe354
Merge pull request #3190 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Mar 25, 2025
a9c9979
Merge pull request #3191 from TechnologyEnhancedLearning/Develop/feat…
rshrirohit Mar 25, 2025
911ace7
Merge pull request #3192 from TechnologyEnhancedLearning/Develop/feat…
rshrirohit Mar 25, 2025
8158abd
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Mar 25, 2025
fffa334
TD-5438-Moved the 'View Proficiencies' button to the top.
Mar 27, 2025
86ec024
Merge pull request #3197 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Mar 28, 2025
9f1b4de
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 1, 2025
d7bbaa9
TD-5439 - A competency description is added to competency when exists.
Auldrin-Possa Apr 1, 2025
6623b90
TD-5482-Related role added to view
Apr 3, 2025
7666ffe
Merge pull request #3204 from TechnologyEnhancedLearning/Develop/feat…
rshrirohit Apr 4, 2025
02df8da
Merge pull request #3206 from TechnologyEnhancedLearning/Develop/feat…
rshrirohit Apr 7, 2025
7a001a4
TD-5481-Added a Details view component in the view to show supervisor…
Auldrin-Possa Apr 7, 2025
572d66b
Merge pull request #3210 from TechnologyEnhancedLearning/Develop/feat…
rshrirohit Apr 9, 2025
305f2d5
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 9, 2025
3821eb4
TD-5511-Framework query modified- The admin userid is used to check t…
Apr 10, 2025
a37e385
Merge pull request #3217 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Apr 15, 2025
fc779eb
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 15, 2025
daec6e8
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 15, 2025
0f1ba1c
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 16, 2025
43875c6
TD-5514-Stored proc updated to add course name in the email subject
Apr 16, 2025
5f3f6d3
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 17, 2025
ff91492
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 17, 2025
120c5dd
TD-5451- Empty competency description check added
Apr 17, 2025
8faae58
Merge pull request #3225 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Apr 24, 2025
3060538
Merge pull request #3229 from TechnologyEnhancedLearning/Develop/Fix/…
rshrirohit Apr 24, 2025
030f828
Merge branch 'DLS-Release-v1.2.0' into DLS-Release-v1.2.1
rshrirohit Apr 25, 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,26 @@
namespace DigitalLearningSolutions.Data.Migrations
{
using FluentMigrator;

[Migration(202503111500)]
public class AddLastAccessedColumn : Migration
{
public override void Up()
{
Alter.Table("Users").AddColumn("LastAccessed").AsDateTime().Nullable();
Alter.Table("DelegateAccounts").AddColumn("LastAccessed").AsDateTime().Nullable();
Alter.Table("AdminAccounts").AddColumn("LastAccessed").AsDateTime().Nullable();

Execute.Sql("UPDATE u SET LastAccessed = (SELECT MAX(s.LoginTime) FROM DelegateAccounts da JOIN Sessions s ON da.ID = s.CandidateId WHERE da.UserID = u.ID) FROM users u;");
Execute.Sql("UPDATE da SET LastAccessed = (SELECT MAX(s.LoginTime) FROM Sessions s WHERE s.CandidateId = da.ID) FROM DelegateAccounts da;");
Execute.Sql("UPDATE da SET LastAccessed = (SELECT ca.LastAccessed FROM CandidateAssessments ca WHERE ca.ID = da.ID) FROM DelegateAccounts da where da.LastAccessed IS NULL;");
Execute.Sql("UPDATE AA SET LastAccessed = (SELECT MAX(AdS.LoginTime) FROM AdminSessions AdS WHERE AdS.AdminID = AA.ID) FROM AdminAccounts AA;");
}
public override void Down()
{
Delete.Column("LastAccessed").FromTable("Users");
Delete.Column("LastAccessed").FromTable("DelegateAccounts");
Delete.Column("LastAccessed").FromTable("AdminAccounts");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@


namespace DigitalLearningSolutions.Data.Migrations
{
using FluentMigrator;

[Migration(2025041161520)]
public class Alter_SendExpiredTBCReminders_AppendCourseName : Migration
{
public override void Up()
{
Execute.Sql(Properties.Resources.TD_5514_Alter_SendExpiredTBCReminders_Up);
}
public override void Down()
{
Execute.Sql(Properties.Resources.TD_5514_Alter_SendExpiredTBCReminders_Down);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,10 @@
<data name="TD_5412_Alter_SendExpiredTBCReminders_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD-5412-Alter_SendExpiredTBCReminders_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="TD_5514_Alter_SendExpiredTBCReminders_Down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD-5514-Alter_SendExpiredTBCReminders_Down.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="TD_5514_Alter_SendExpiredTBCReminders_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Scripts\TD-5514-Alter_SendExpiredTBCReminders_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
</root>
Binary file not shown.
Binary file not shown.
21 changes: 15 additions & 6 deletions DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,22 @@ public class FrameworkDataService : IFrameworkDataService
OwnerAdminID,
(SELECT Forename + ' ' + Surname + (CASE WHEN Active = 1 THEN '' ELSE ' (Inactive)' END) AS Expr1 FROM AdminUsers WHERE (AdminID = FW.OwnerAdminID)) AS Owner,
BrandID,
CategoryID,
FW.CategoryID,
TopicID,
CreatedDate,
PublishStatusID,
UpdatedByAdminID,
(SELECT Forename + ' ' + Surname + (CASE WHEN Active = 1 THEN '' ELSE ' (Inactive)' END) AS Expr1 FROM AdminUsers AS AdminUsers_1 WHERE (AdminID = FW.UpdatedByAdminID)) AS UpdatedBy,
CASE WHEN FW.OwnerAdminID = @adminId THEN 3 WHEN fwc.CanModify = 1 THEN 2 WHEN fwc.CanModify = 0 THEN 1 ELSE 0 END AS UserRole,
CASE
WHEN (aa.UserID = (SELECT UserID FROM AdminAccounts WHERE ID = @adminId)) THEN 3
WHEN (fwc.CanModify = 1) OR
(SELECT COUNT(*)
FROM FrameworkCollaborators fc
JOIN AdminAccounts aa1 ON fc.AdminID = aa1.ID
WHERE fc.FrameworkID = fw.ID
AND fc.CanModify = 1 AND fc.IsDeleted = 0
AND aa1.UserID = (SELECT aa2.UserID FROM AdminAccounts aa2 WHERE aa2.ID = 12842)) > 0 THEN 2
WHEN fwc.CanModify = 0 THEN 1 ELSE 0 END AS UserRole,
fwr.ID AS FrameworkReviewID";

private const string BrandedFrameworkFields =
Expand All @@ -304,9 +313,9 @@ FROM CourseTopics
private const string FlagFields = @"fl.ID AS FlagId, fl.FrameworkId, fl.FlagName, fl.FlagGroup, fl.FlagTagClass";

private const string FrameworkTables =
@"Frameworks AS FW LEFT OUTER JOIN
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";
@"Frameworks AS FW INNER JOIN AdminAccounts AS aa ON aa.ID = fw.OwnerAdminID
LEFT OUTER JOIN 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 =
@"SELECT AQ.ID, AQ.Question, AQ.MinValue, AQ.MaxValue, AQ.AssessmentQuestionInputTypeID, AQI.InputTypeName, AQ.AddedByAdminId, CASE WHEN AQ.AddedByAdminId = @adminId THEN 1 ELSE 0 END AS UserIsOwner, AQ.CommentsPrompt, AQ.CommentsHint";
Expand Down Expand Up @@ -707,7 +716,7 @@ FROM [FrameworkCompetencies]
new { competencyId, frameworkCompetencyGroupID }
);
}
if(addDefaultQuestions)
if (addDefaultQuestions)
{
AddDefaultQuestionsToCompetency(competencyId, frameworkId);
}
Expand Down
63 changes: 63 additions & 0 deletions DigitalLearningSolutions.Data/DataServices/LoginDataService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
namespace DigitalLearningSolutions.Data.DataServices
{
using Dapper;
using System.Data;

public interface ILoginDataService
{
void UpdateLastAccessedForUsersTable(int Id);

void UpdateLastAccessedForDelegatesAccountsTable(int Id);

void UpdateLastAccessedForAdminAccountsTable(int Id);
}

public class LoginDataService : ILoginDataService
{
private readonly IDbConnection connection;

public LoginDataService(IDbConnection connection)
{
this.connection = connection;
}

public void UpdateLastAccessedForUsersTable(int Id)
{
connection.Execute(
@"UPDATE Users SET
LastAccessed = GetUtcDate()
WHERE ID = @Id",
new
{
Id
}
);
}

public void UpdateLastAccessedForDelegatesAccountsTable(int Id)
{
connection.Execute(
@"UPDATE DelegateAccounts SET
LastAccessed = GetUtcDate()
WHERE ID = @Id",
new
{
Id
}
);
}

public void UpdateLastAccessedForAdminAccountsTable(int Id)
{
connection.Execute(
@"UPDATE AdminAccounts SET
LastAccessed = GetUtcDate()
WHERE ID = @Id",
new
{
Id
}
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ FROM AdminAccounts AS aa
aa.IsSupervisor,
aa.IsTrainer,
aa.CategoryID,
aa.LastAccessed,
CASE
WHEN aa.CategoryID IS NULL THEN 'All'
ELSE cc.CategoryName
Expand Down Expand Up @@ -369,7 +370,7 @@ public IEnumerable<AdminAccount> GetAdminAccountsByUserId(int userId)
}

string BaseSelectQuery = $@"SELECT aa.ID, aa.UserID, aa.CentreID, aa.Active, aa.IsCentreAdmin, aa.IsReportsViewer, aa.IsSuperAdmin, aa.IsCentreManager,
aa.IsContentManager, aa.IsContentCreator, aa.IsSupervisor, aa.IsTrainer, aa.CategoryID, aa.IsFrameworkDeveloper, aa.IsFrameworkContributor,aa.ImportOnly,
aa.LastAccessed, aa.IsContentManager, aa.IsContentCreator, aa.IsSupervisor, aa.IsTrainer, aa.CategoryID, aa.IsFrameworkDeveloper, aa.IsFrameworkContributor,aa.ImportOnly,
aa.IsWorkforceManager, aa.IsWorkforceContributor, aa.IsLocalWorkforceManager, aa.IsNominatedSupervisor,
u.ID, u.PrimaryEmail, u.FirstName, u.LastName, u.Active, u.FailedLoginCount,
c.CentreID, c.CentreName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ FROM DelegateAccounts AS da
c.CentreName,
da.CentreID,
da.DateRegistered,
da.LastAccessed,
da.RegistrationConfirmationHash,
c.Active AS CentreActive,
COALESCE(ucd.Email, u.PrimaryEmail) AS EmailAddress,
Expand Down Expand Up @@ -124,6 +125,7 @@ FROM AdminAccounts aa
c.CentreName,
da.CentreID,
da.DateRegistered,
da.LastAccessed,
da.RegistrationConfirmationHash,
c.Active AS CentreActive,
COALESCE(ucd.Email, u.PrimaryEmail) AS EmailAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ public partial class UserDataService : IUserDataService
u.ProfessionalRegistrationNumber,
u.ProfileImage,
u.Active,
u.LastAccessed,
u.ResetPasswordID,
u.TermsAgreed,
u.FailedLoginCount,
Expand Down Expand Up @@ -619,6 +620,7 @@ public void UpdateUserDetailsAccount(string firstName, string lastName, string p
ce.CentreName,
ce.Active AS CentreActive,
da.DateRegistered,
da.LastAccessed,
da.CandidateNumber,
da.Approved,
da.SelfReg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public SuperAdminDelegateAccount(DelegateEntity delegateEntity)
LearningHubAuthId = delegateEntity.UserAccount.LearningHubAuthId;
RegistrationConfirmationHash = delegateEntity.DelegateAccount.RegistrationConfirmationHash;
DateRegistered = delegateEntity.DelegateAccount.DateRegistered;
LastAccessed = delegateEntity.DelegateAccount.LastAccessed;
SelfReg = delegateEntity.DelegateAccount.SelfReg;
Active = delegateEntity.DelegateAccount.Active;
EmailVerified = delegateEntity.UserAccount.EmailVerified;
Expand Down
3 changes: 3 additions & 0 deletions DigitalLearningSolutions.Data/Models/User/AdminAccount.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace DigitalLearningSolutions.Data.Models.User
{
using System;

public class AdminAccount
{
public int Id { get; set; }
Expand All @@ -26,6 +28,7 @@ public class AdminAccount
public bool IsWorkforceContributor { get; set; }
public bool IsLocalWorkforceManager { get; set; }
public bool IsNominatedSupervisor { get; set; }
public DateTime? LastAccessed { get; set; }

public bool IsCmsAdministrator => ImportOnly && IsContentManager;
public bool IsCmsManager => IsContentManager && !ImportOnly;
Expand Down
2 changes: 2 additions & 0 deletions DigitalLearningSolutions.Data/Models/User/AdminEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using DigitalLearningSolutions.Data.Helpers;
using DigitalLearningSolutions.Data.Models.Centres;
using DigitalLearningSolutions.Data.Models.SearchSortFilterPaginate;
using System;

public class AdminEntity : BaseSearchableItem
{
Expand Down Expand Up @@ -72,6 +73,7 @@ public override string SearchableName
public bool IsSuperAdmin => AdminAccount.IsSuperAdmin;
public bool IsReportsViewer => AdminAccount.IsReportsViewer;
public bool IsActive => AdminAccount.Active;
public DateTime? LastAccessed => AdminAccount.LastAccessed;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class DelegateAccount
public bool CentreActive { get; set; }
public string CandidateNumber { get; set; } = string.Empty;
public DateTime DateRegistered { get; set; }
public DateTime? LastAccessed { get; set; }
public string? Answer1 { get; set; }
public string? Answer2 { get; set; }
public string? Answer3 { get; set; }
Expand Down
1 change: 1 addition & 0 deletions DigitalLearningSolutions.Data/Models/User/DelegateUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class DelegateUser : User
public int UserId { get; set; }
public string CandidateNumber { get; set; } = string.Empty;
public DateTime? DateRegistered { get; set; }
public DateTime? LastAccessed { get; set; }
public int JobGroupId { get; set; }
public string? JobGroupName { get; set; }
public string? Answer1 { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public DelegateUserCard(DelegateEntity delegateEntity)
Password = delegateEntity.UserAccount.PasswordHash;
CandidateNumber = delegateEntity.DelegateAccount.CandidateNumber;
DateRegistered = delegateEntity.DelegateAccount.DateRegistered;
LastAccessed = delegateEntity.DelegateAccount.LastAccessed;
JobGroupId = delegateEntity.UserAccount.JobGroupId;
JobGroupName = delegateEntity.UserAccount.JobGroupName;
Answer1 = delegateEntity.DelegateAccount.Answer1;
Expand Down
1 change: 1 addition & 0 deletions DigitalLearningSolutions.Data/Models/User/UserAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class UserAccount
public string? ProfessionalRegistrationNumber { get; set; }
public byte[]? ProfileImage { get; set; }
public bool Active { get; set; }
public DateTime? LastAccessed { get; set; }
public int? ResetPasswordId { get; set; }
public DateTime? TermsAgreed { get; set; }
public int FailedLoginCount { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DigitalLearningSolutions.Data.DataServices;
using DigitalLearningSolutions.Data.Enums;
using DigitalLearningSolutions.Data.Helpers;
using DigitalLearningSolutions.Data.Models;
Expand Down Expand Up @@ -32,14 +33,15 @@ private static readonly (string?, List<(int centreId, string centreName, string
private LoginService loginService = null!;
private IUserService userService = null!;
private IUserVerificationService userVerificationService = null!;
private ILoginDataService loginDataService = null!;

[SetUp]
public void Setup()
{
userVerificationService = A.Fake<IUserVerificationService>(x => x.Strict());
userService = A.Fake<IUserService>(x => x.Strict());

loginService = new LoginService(userService, userVerificationService);
loginService = new LoginService(userService, userVerificationService, loginDataService);
}

[Test]
Expand Down
Loading
Loading