Skip to content

Commit a91115d

Browse files
Merge remote-tracking branch 'origin/Release-2024.38' into Develop/Features/TD-4427-ChecktheminimumoptionalcompetencieshavebeenaddedbeforeenablingRequestSign-off
2 parents cbd0dff + 39243c8 commit a91115d

File tree

23 files changed

+414
-359
lines changed

23 files changed

+414
-359
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+

2+
namespace DigitalLearningSolutions.Data.Migrations
3+
{
4+
using FluentMigrator;
5+
6+
[Migration(202401081132)]
7+
public class AddMinimumOptionalCompetenciesToSelfAssessmentsTable : Migration
8+
{
9+
public override void Up()
10+
{
11+
Alter.Table("SelfAssessments").AddColumn("MinimumOptionalCompetencies").AsInt32().NotNullable().WithDefaultValue(0);
12+
}
13+
14+
public override void Down()
15+
{
16+
Delete.Column("MinimumOptionalCompetencies").FromTable("SelfAssessments");
17+
}
18+
}
19+
}

DigitalLearningSolutions.Data/DataServices/CourseContentDataService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ FROM Sessions AS S1 WITH (NOLOCK)
251251
WHERE S1.CandidateID = Progress.CandidateID
252252
AND S1.CustomisationID = Progress.CustomisationID
253253
AND S1.LoginTime >= Progress.FirstSubmittedTime),
254-
SubmittedTime = GETUTCDATE()
254+
SubmittedTime = GETDATE()
255255
WHERE Progress.ProgressID = @progressId",
256256
new { progressId }
257257
);

DigitalLearningSolutions.Data/DataServices/ProgressDataService.cs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public interface IProgressDataService
1515
{
1616
IEnumerable<Progress> GetDelegateProgressForCourse(int delegateId, int customisationId);
1717

18-
void UpdateProgressSupervisorAndCompleteByDate(int progressId, int supervisorAdminId, DateTime? completeByDate, int enrollmentMethodID, DateTime? firstSubmittedTime);
18+
void UpdateProgressSupervisorAndCompleteByDate(int progressId, int supervisorAdminId, DateTime? completeByDate, int enrollmentMethodID);
19+
void UpdateProgressSupervisor(int progressId, int supervisorAdminId);
1920
int CreateNewDelegateProgress(
2021
int delegateId,
2122
int customisationId,
@@ -144,21 +145,31 @@ public void UpdateProgressSupervisorAndCompleteByDate(
144145
int progressId,
145146
int supervisorAdminId,
146147
DateTime? completeByDate,
147-
int enrollmentMethodID,
148-
DateTime? firstSubmittedTime
148+
int enrollmentMethodID
149149
)
150150
{
151151
connection.Execute(
152152
@"UPDATE Progress SET
153153
SupervisorAdminID = @supervisorAdminId,
154154
CompleteByDate = @completeByDate,
155-
EnrollmentMethodID = @enrollmentMethodID,
156-
FirstSubmittedTime= @firstSubmittedTime
155+
EnrollmentMethodID = @enrollmentMethodID
157156
WHERE ProgressID = @progressId",
158-
new { progressId, supervisorAdminId, completeByDate, enrollmentMethodID, @firstSubmittedTime }
157+
new { progressId, supervisorAdminId, completeByDate, enrollmentMethodID }
159158
);
160159
}
161160

161+
public void UpdateProgressSupervisor(
162+
int progressId,
163+
int supervisorAdminId
164+
)
165+
{
166+
connection.Execute(
167+
@"UPDATE Progress SET
168+
SupervisorAdminID = @supervisorAdminId
169+
WHERE ProgressID = @progressId",
170+
new { progressId, supervisorAdminId }
171+
);
172+
}
162173
public int CreateNewDelegateProgress(
163174
int delegateId,
164175
int customisationId,

DigitalLearningSolutions.Data/Enums/SelfAssessmentCompetencyFilter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
public enum SelfAssessmentCompetencyFilter
44
{
5+
Optional = -11,
56
AwaitingConfirmation = -10,
67
PendingConfirmation = -9,
78
RequiresSelfAssessment = -8,

DigitalLearningSolutions.Data/Utilities/ClockUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IClockUtility
1010

1111
public class ClockUtility : IClockUtility
1212
{
13-
public DateTime UtcNow => DateTime.Now;
13+
public DateTime UtcNow => DateTime.UtcNow;
1414
public DateTime UtcToday => UtcNow.Date;
1515
}
1616
}

DigitalLearningSolutions.Web.Tests/Services/GroupServiceTests/GroupsServiceEnrolDelegateTests.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ public void EnrolDelegateOnGroupCourses_updates_existing_progress_record()
357357
reusableProgressRecord.ProgressId,
358358
A<int>._,
359359
A<DateTime?>._,
360-
A<int>._,
361-
A<DateTime?>._
360+
A<int>._
362361
)
363362
).MustHaveHappened();
364363
}
@@ -395,8 +394,7 @@ public void
395394
reusableProgressRecord.ProgressId,
396395
reusableProgressRecord.SupervisorAdminId,
397396
A<DateTime?>._,
398-
A<int>._,
399-
A<DateTime?>._
397+
A<int>._
400398
)
401399
).MustHaveHappened();
402400
}
@@ -433,8 +431,7 @@ public void EnrolDelegateOnGroupCourses_update_uses_course_supervisor_id_if_cour
433431
reusableProgressRecord.ProgressId,
434432
supervisorId,
435433
A<DateTime?>._,
436-
A<int>._,
437-
A<DateTime?>._
434+
A<int>._
438435
)
439436
).MustHaveHappened();
440437
}
@@ -471,8 +468,7 @@ public void
471468
reusableProgressRecord.ProgressId,
472469
A<int>._,
473470
null,
474-
A<int>._,
475-
A<DateTime?>._
471+
A<int>._
476472
)
477473
).MustHaveHappened();
478474
}
@@ -511,8 +507,7 @@ public void
511507
reusableProgressRecord.ProgressId,
512508
A<int>._,
513509
expectedFutureDate,
514-
A<int>._,
515-
A<DateTime?>._
510+
A<int>._
516511
)
517512
).MustHaveHappened();
518513
}

DigitalLearningSolutions.Web.Tests/Services/GroupServiceTests/GroupsServiceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ private void DelegateMustNotHaveBeenAddedToAGroup()
721721
private void DelegateProgressRecordMustNotHaveBeenUpdated()
722722
{
723723
A.CallTo(
724-
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(A<int>._, A<int>._, A<DateTime?>._, A<int>._, A<DateTime?>._)
724+
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(A<int>._, A<int>._, A<DateTime?>._, A<int>._)
725725
).MustNotHaveHappened();
726726
}
727727

@@ -765,7 +765,7 @@ private void DatabaseModificationsDoNothing()
765765
A.CallTo(() => groupsDataService.AddDelegateToGroup(A<int>._, A<int>._, A<DateTime>._, A<int>._))
766766
.DoesNothing();
767767
A.CallTo(
768-
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(A<int>._, A<int>._, A<DateTime?>._, A<int>._, A<DateTime?>._)
768+
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(A<int>._, A<int>._, A<DateTime?>._, A<int>._)
769769
).DoesNothing();
770770
A.CallTo(
771771
() => progressDataService.CreateNewDelegateProgress(

DigitalLearningSolutions.Web.Tests/Services/ProgressServiceTests.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void UpdateSupervisor_does_not_update_records_if_new_supervisor_matches_c
5858

5959
// Then
6060
A.CallTo(
61-
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(A<int>._, A<int>._, A<DateTime?>._, A<int>._, A<DateTime?>._)
61+
() => progressDataService.UpdateProgressSupervisor(A<int>._, A<int>._)
6262
).MustNotHaveHappened();
6363
A.CallTo(
6464
() => progressDataService.ClearAspProgressVerificationRequest(A<int>._)
@@ -80,12 +80,9 @@ public void UpdateSupervisor_updates_records_if_new_supervisor_does_not_match_cu
8080

8181
// Then
8282
A.CallTo(
83-
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(
83+
() => progressDataService.UpdateProgressSupervisor(
8484
progressId,
85-
newSupervisorId,
86-
A<DateTime?>._,
87-
A<int>._,
88-
A<DateTime?>._
85+
newSupervisorId
8986
)
9087
).MustHaveHappened();
9188
A.CallTo(
@@ -107,7 +104,7 @@ public void UpdateSupervisor_sets_supervisor_id_to_0_if_new_supervisor_is_null()
107104

108105
// Then
109106
A.CallTo(
110-
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(progressId, 0, A<DateTime?>._, A<int>._, A<DateTime?>._)
107+
() => progressDataService.UpdateProgressSupervisor(progressId, 0)
111108
).MustHaveHappened();
112109
A.CallTo(
113110
() => progressDataService.ClearAspProgressVerificationRequest(progressId)
@@ -124,7 +121,7 @@ public void UpdateSupervisor_throws_exception_if_no_progress_record_found()
124121
// Then
125122
Assert.Throws<ProgressNotFoundException>(() => progressService.UpdateSupervisor(progressId, null));
126123
A.CallTo(
127-
() => progressDataService.UpdateProgressSupervisorAndCompleteByDate(A<int>._, A<int>._, A<DateTime?>._, A<int>._, A<DateTime?>._)
124+
() => progressDataService.UpdateProgressSupervisor(A<int>._, A<int>._)
128125
).MustNotHaveHappened();
129126
A.CallTo(
130127
() => progressDataService.ClearAspProgressVerificationRequest(A<int>._)

DigitalLearningSolutions.Web/Helpers/SupervisorCompetencyFilterHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ private static void ApplyResponseStatusFilters(ref IEnumerable<Competency> compe
4848
|| (filters.Contains((int)SelfAssessmentCompetencyFilter.ConfirmationRejected) && c.AssessmentQuestions.Any(q => q.Verified.HasValue && q.SignedOff != true))
4949
|| (filters.Contains((int)SelfAssessmentCompetencyFilter.AwaitingConfirmation) && c.AssessmentQuestions.Any(q => q.Verified == null && q.Requested != null && q.UserIsVerifier == true))
5050
|| (filters.Contains((int)SelfAssessmentCompetencyFilter.Verified) && c.AssessmentQuestions.Any(q => q.Verified.HasValue && q.SignedOff == true))
51+
|| (filters.Contains((int)SelfAssessmentCompetencyFilter.Optional) && c.Optional )
5152
where (wordsInSearchText.Count() == 0 || searchTextMatchesGroup || searchTextMatchesCompetencyDescription || searchTextMatchesCompetencyName)
5253
&& (!appliedResponseStatusFilters.Any() || responseStatusFilterMatchesAnyQuestion)
5354
select c;
@@ -111,6 +112,7 @@ public static bool IsResponseStatusFilter(int filter)
111112
{
112113
var responseStatusFilters = new int[]
113114
{
115+
(int)SelfAssessmentCompetencyFilter.Optional,
114116
(int)SelfAssessmentCompetencyFilter.RequiresSelfAssessment,
115117
(int)SelfAssessmentCompetencyFilter.SelfAssessed,
116118
(int)SelfAssessmentCompetencyFilter.Verified,

DigitalLearningSolutions.Web/Services/EnrolService.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ public void EnrolDelegateOnCourse(int delegateId, int customisationId, int custo
104104
progressRecord.ProgressId,
105105
supervisorAdminId ?? 0,
106106
completeByDate,
107-
2,
108-
clockUtility.UtcNow
109-
);
107+
2);
110108
}
111109
}
112110
else
@@ -188,7 +186,7 @@ by the system because a previous course completion has expired.</p>
188186

189187
public int EnrolOnActivitySelfAssessment(int selfAssessmentId, int candidateId, int supervisorId, string adminEmail, int selfAssessmentSupervisorRoleId, DateTime? completeByDate, int delegateUserId, int centreId, int? enrolledByAdminId)
190188
{
191-
return courseDataService.EnrolOnActivitySelfAssessment(selfAssessmentId, candidateId, supervisorId, adminEmail, selfAssessmentSupervisorRoleId, completeByDate, delegateUserId, centreId, enrolledByAdminId);
189+
return courseDataService.EnrolOnActivitySelfAssessment(selfAssessmentId, candidateId, supervisorId, adminEmail, selfAssessmentSupervisorRoleId, completeByDate, delegateUserId, centreId, enrolledByAdminId);
192190
}
193191
}
194192
}

0 commit comments

Comments
 (0)