Skip to content

Commit d77f528

Browse files
authored
Merge pull request #2691 from TechnologyEnhancedLearning/Develop/Fixes/TD-4218-'Lastaccess'dateandtimeshouldn'tshowonthelearnerrecordwhenadminregistersthedelegatefromthe'Trackingsystem'
TD-4218 'Last access' date and time shouldn't show on the learner record when admin registers the delegate from the 'Tracking system'
2 parents 7d48aaa + 39570ba commit d77f528

File tree

8 files changed

+36
-19
lines changed

8 files changed

+36
-19
lines changed

DigitalLearningSolutions.Data/DataServices/ProgressDataService.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ int CreateNewDelegateProgress(
2424
int enrollmentMethodId,
2525
int? enrolledByAdminId,
2626
DateTime? completeByDate,
27-
int supervisorAdminId
27+
int supervisorAdminId,
28+
DateTime firstSubmittedTime
2829
);
2930

3031
void CreateNewAspProgress(int tutorialId, int progressId);
@@ -166,7 +167,8 @@ public int CreateNewDelegateProgress(
166167
int enrollmentMethodId,
167168
int? enrolledByAdminId,
168169
DateTime? completeByDate,
169-
int supervisorAdminId
170+
int supervisorAdminId,
171+
DateTime firstSubmittedTime
170172
)
171173
{
172174
var progressId = connection.QuerySingle<int>(
@@ -178,7 +180,8 @@ int supervisorAdminId
178180
EnrollmentMethodID,
179181
EnrolledByAdminID,
180182
CompleteByDate,
181-
SupervisorAdminID)
183+
SupervisorAdminID,
184+
FirstSubmittedTime)
182185
OUTPUT Inserted.ProgressID
183186
VALUES (
184187
@delegateId,
@@ -188,7 +191,8 @@ OUTPUT Inserted.ProgressID
188191
@enrollmentMethodId,
189192
@enrolledByAdminId,
190193
@completeByDate,
191-
@supervisorAdminId)",
194+
@supervisorAdminId,
195+
@firstSubmittedTime)",
192196
new
193197
{
194198
delegateId,
@@ -199,6 +203,7 @@ OUTPUT Inserted.ProgressID
199203
enrolledByAdminId,
200204
completeByDate,
201205
supervisorAdminId,
206+
firstSubmittedTime
202207
}
203208
);
204209

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public void EnrolDelegateOnGroupCourses_adds_new_progress_record_when_no_existin
5858
3,
5959
null,
6060
A<DateTime?>._,
61-
A<int>._
61+
A<int>._,
62+
testDate
6263
)
6364
).MustHaveHappened();
6465
A.CallTo(() => progressDataService.CreateNewAspProgress(GenericRelatedTutorialId, GenericNewProgressId))
@@ -100,7 +101,8 @@ public void EnrolDelegateOnGroupCourses_adds_new_progress_record_when_existing_p
100101
3,
101102
null,
102103
A<DateTime?>._,
103-
A<int>._
104+
A<int>._,
105+
testDate
104106
)
105107
).MustHaveHappened();
106108
A.CallTo(() => progressDataService.CreateNewAspProgress(GenericRelatedTutorialId, GenericNewProgressId))
@@ -142,7 +144,8 @@ public void EnrolDelegateOnGroupCourses_adds_new_progress_record_when_existing_p
142144
3,
143145
null,
144146
A<DateTime?>._,
145-
A<int>._
147+
A<int>._,
148+
testDate
146149
)
147150
).MustHaveHappened();
148151
A.CallTo(() => progressDataService.CreateNewAspProgress(GenericRelatedTutorialId, GenericNewProgressId))
@@ -184,7 +187,8 @@ public void
184187
3,
185188
null,
186189
A<DateTime?>._,
187-
0
190+
0 ,
191+
testDate
188192
)
189193
).MustHaveHappened();
190194
A.CallTo(() => progressDataService.CreateNewAspProgress(GenericRelatedTutorialId, GenericNewProgressId))
@@ -227,7 +231,8 @@ public void
227231
3,
228232
null,
229233
testDate.AddMonths(12),
230-
supervisorId
234+
supervisorId,
235+
testDate
231236
)
232237
).MustHaveHappened();
233238
A.CallTo(() => progressDataService.CreateNewAspProgress(GenericRelatedTutorialId, GenericNewProgressId))
@@ -269,7 +274,8 @@ public void
269274
3,
270275
null,
271276
null,
272-
A<int>._
277+
A<int>._,
278+
testDate
273279
)
274280
).MustHaveHappened();
275281
A.CallTo(() => progressDataService.CreateNewAspProgress(GenericRelatedTutorialId, GenericNewProgressId))
@@ -313,7 +319,8 @@ public void
313319
3,
314320
null,
315321
expectedFutureDate,
316-
A<int>._
322+
A<int>._,
323+
testDate
317324
)
318325
).MustHaveHappened();
319326
A.CallTo(() => progressDataService.CreateNewAspProgress(GenericRelatedTutorialId, GenericNewProgressId))

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,8 @@ private void NewDelegateProgressRecordMustNotHaveBeenAdded()
736736
A<int>._,
737737
A<int?>._,
738738
A<DateTime?>._,
739-
A<int>._
739+
A<int>._,
740+
A<DateTime>._
740741
)
741742
).MustNotHaveHappened();
742743
A.CallTo(
@@ -775,7 +776,8 @@ private void DatabaseModificationsDoNothing()
775776
A<int>._,
776777
A<int?>._,
777778
A<DateTime?>._,
778-
A<int>._
779+
A<int>._,
780+
A<DateTime>._
779781
)
780782
).Returns(0);
781783
A.CallTo(() => progressDataService.CreateNewAspProgress(A<int>._, A<int>._)).DoesNothing();
@@ -804,7 +806,8 @@ private void SetupEnrolProcessFakes(
804806
A<int>._,
805807
A<int?>._,
806808
A<DateTime?>._,
807-
A<int>._
809+
A<int>._,
810+
A<DateTime>._
808811
)
809812
).Returns(newProgressId);
810813
A.CallTo(() => tutorialContentDataService.GetTutorialIdsForCourse(A<int>._))

DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/DelegateCourseInfoViewModelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void DelegateCourseInfoViewModel_sets_date_strings_correctly()
5656
}
5757

5858
[TestCase(1, "Self enrolled")]
59-
[TestCase(2, "Enrolled by Test Admin")]
59+
[TestCase(2, "Enrolled by Admin - Test Admin")]
6060
[TestCase(3, "Group")]
6161
[TestCase(4, "System")]
6262
public void DelegateCourseInfoViewModel_sets_enrollment_method_correctly(

DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/DelegateProgress/DelegateProgressViewModelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void ViewModel_does_not_include_email_if_not_set()
107107

108108
[Test]
109109
[TestCase(1, "Self enrolled")]
110-
[TestCase(2, "Enrolled by Ronnie Dio")]
110+
[TestCase(2, "Enrolled by Admin - Ronnie Dio")]
111111
[TestCase(3, "Group")]
112112
[TestCase(4, "System")]
113113
public void ViewModel_sets_Enrolment_method_text_correctly(int enrolmentMethodId, string expectedText)

DigitalLearningSolutions.Web/Services/EnrolService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ public void EnrolDelegateOnCourse(int delegateId, int customisationId, int custo
118118
2,
119119
enrolledByAdminId,
120120
completeByDate,
121-
supervisorAdminId ?? 0
121+
supervisorAdminId ?? 0,
122+
clockUtility.UtcNow
122123
);
123124
var tutorialsForCourse =
124125
tutorialContentDataService.GetTutorialIdsForCourse(customisationId);

DigitalLearningSolutions.Web/Services/GroupsService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,8 @@ IEnumerable<NotificationPreference> delegateNotificationPreferences
759759
3,
760760
addedByAdminId,
761761
completeByDate,
762-
groupCourse.SupervisorAdminId ?? 0
762+
groupCourse.SupervisorAdminId ?? 0,
763+
clockUtility.UtcNow
763764
);
764765

765766
var tutorialsForCourse =

DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/Shared/DelegateCourseInfoViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private DelegateCourseInfoViewModel(DelegateCourseInfo info)
7777
EnrolmentMethod = info.EnrolmentMethodId switch
7878
{
7979
1 => "Self enrolled",
80-
2 => "Enrolled by " + (enrolledByFullName ?? "Admin"),
80+
2 => enrolledByFullName != null ? "Enrolled by Admin - " + enrolledByFullName : "Enrolled by Admin",
8181
3 => "Group",
8282
_ => "System",
8383
};

0 commit comments

Comments
 (0)