-
Notifications
You must be signed in to change notification settings - Fork 1
HEEDLS-555 View delegate page - course section #498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0f1711e
89fcb17
7800fc2
649b221
4b230ed
f0879e8
1156114
69baeb7
49c6a88
1c24175
06b21e6
feb5c4b
201f7c6
eff0f8e
7f1b13e
63c681a
9cdeff7
46f103f
7365ac3
a1d4291
6534359
72bafe5
63bf216
f3f9b87
5ef43f9
55fc34c
807aa16
5d682dd
284ceaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| namespace DigitalLearningSolutions.Data.DataServices | ||
| namespace DigitalLearningSolutions.Data.DataServices | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
@@ -18,6 +18,8 @@ public interface ICourseDataService | |
| void EnrolOnSelfAssessment(int selfAssessmentId, int candidateId); | ||
| int GetNumberOfActiveCoursesAtCentreForCategory(int centreId, int categoryId); | ||
| IEnumerable<CourseStatistics> GetCourseStatisticsAtCentreForCategoryId(int centreId, int categoryId); | ||
| IEnumerable<DelegateCourseInfo> GetDelegateCoursesInfo(int delegateId); | ||
| (int totalAttempts, int attemptsPassed) GetDelegateCourseAttemptStats(int delegateId, int customisationId); | ||
| CourseDetails? GetCourseDetails(int customisationId, int centreId, int categoryId); | ||
| } | ||
|
|
||
|
|
@@ -198,6 +200,56 @@ FROM dbo.Customisations AS cu | |
| ); | ||
| } | ||
|
|
||
| public IEnumerable<DelegateCourseInfo> GetDelegateCoursesInfo(int delegateId) | ||
| { | ||
| return connection.Query<DelegateCourseInfo>( | ||
| @"SELECT | ||
| cu.CustomisationID AS CustomisationId, | ||
| ap.ApplicationName, | ||
| cu.CustomisationName, | ||
| au.Forename AS SupervisorForename, | ||
| au.Surname AS SupervisorSurname, | ||
| pr.FirstSubmittedTime AS Enrolled, | ||
| pr.SubmittedTime AS LastUpdated, | ||
| pr.CompleteByDate AS CompleteBy, | ||
| pr.Completed AS Completed, | ||
| pr.Evaluated AS Evaluated, | ||
| pr.EnrollmentMethodID AS EnrolmentMethodId, | ||
| pr.LoginCount, | ||
| pr.Duration AS LearningTime, | ||
| pr.DiagnosticScore, | ||
| cu.IsAssessed, | ||
| pr.Answer1, | ||
| pr.Answer2, | ||
| pr.Answer3 | ||
| FROM Customisations cu | ||
| INNER JOIN Applications ap ON ap.ApplicationID = cu.ApplicationID | ||
| INNER JOIN Progress pr ON pr.CustomisationID = cu.CustomisationID | ||
| LEFT OUTER JOIN AdminUsers au ON au.AdminID = pr.SupervisorAdminId | ||
| WHERE pr.CandidateID = @delegateId | ||
| AND ap.ArchivedDate IS NULL | ||
| AND pr.RemovedDate IS NULL", | ||
| new { delegateId } | ||
| ); | ||
| } | ||
|
|
||
| public (int totalAttempts, int attemptsPassed) GetDelegateCourseAttemptStats( | ||
| int delegateId, | ||
| int customisationId | ||
| ) | ||
| { | ||
| return connection.QueryFirstOrDefault<(int, int)>( | ||
| @"SELECT COUNT(aa.Status) AS TotalAttempts, | ||
| COUNT(CASE WHEN aa.Status=1 THEN 1 END) AS AttemptsPassed | ||
|
Comment on lines
+242
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it makes sense pulling these two numbers together with other course data? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it would make the query too complicated. Also these are not needed in many cases any where IsAssessed=0. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there is a bit more refactoring needed in that case (also see my comment on the controller). If these aren't needed because IsAssessed=0, why are we still always calling it? |
||
| FROM AssessAttempts aa | ||
| INNER JOIN Progress AS pr ON pr.ProgressID = aa.ProgressID | ||
| WHERE pr.CustomisationID = @customisationId | ||
| AND pr.CandidateID = @delegateId | ||
| AND pr.RemovedDate IS NULL", | ||
| new { delegateId, customisationId } | ||
| ); | ||
| } | ||
|
|
||
| public CourseDetails? GetCourseDetails(int customisationId, int centreId, int categoryId) | ||
| { | ||
| return connection.Query<CourseDetails>( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.