Skip to content

Commit cd70949

Browse files
Corrected the build errors
1 parent 7a9a616 commit cd70949

File tree

5 files changed

+44
-4
lines changed

5 files changed

+44
-4
lines changed

OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/Services/IMoodleApiService.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ public interface IMoodleApiService
3030
/// <param name="userId">Moodle user id.</param>
3131
/// <param name="months">pageNumber.</param>
3232
/// <returns> List of MoodleCourseResponseModel.</returns>
33-
Task<List<MoodleEnrolledCourseResponseModel>> GetRecentEnrolledCoursesAsync(int userId, int? months = null);
33+
Task<List<MoodleEnrolledCourseResponseModel>> GetRecentEnrolledCoursesAsync(int userId, int? months = null);
34+
35+
/// <summary>
36+
/// GetEnrolledCoursesAsync.
37+
/// </summary>
38+
/// <param name="userId">Moodle user id.</param>
39+
/// <param name="months">pageNumber.</param>
40+
/// <returns> List of MoodleCourseResponseModel.</returns>
41+
Task<List<MoodleEnrolledCourseResponseModel>> GetEnrolledCoursesHistoryAsync(int userId);
3442

3543
/// <summary>
3644
/// GetEnrolledCoursesAsync.

OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/MoodleApiService.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,38 @@ public async Task<List<MoodleEnrolledCourseResponseModel>> GetRecentEnrolledCour
136136
}
137137
}
138138

139+
/// <summary>
140+
/// GetEnrolledCoursesAsync.
141+
/// </summary>
142+
/// <param name="userId">Moodle user id.</param>
143+
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
144+
public async Task<List<MoodleEnrolledCourseResponseModel>> GetEnrolledCoursesHistoryAsync(int userId)
145+
{
146+
try
147+
{
148+
userId = 3;
149+
var parameters = new Dictionary<string, string>
150+
{
151+
{ "userid", userId.ToString() }
152+
};
153+
154+
// Fetch enrolled courses
155+
var recentEnrolledCourses = await GetCallMoodleApiAsync<List<MoodleEnrolledCourseResponseModel>>(
156+
"mylearningservice_get_recent_courses",
157+
parameters
158+
);
159+
160+
if (recentEnrolledCourses == null || recentEnrolledCourses.Count == 0)
161+
return new List<MoodleEnrolledCourseResponseModel>();
162+
163+
return recentEnrolledCourses.ToList();
164+
}
165+
catch (Exception ex)
166+
{
167+
return null;
168+
}
169+
}
170+
139171
/// <summary>
140172
/// GetUserLearningHistory.
141173
/// </summary>

OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/MyLearningService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public async Task<MyLearningActivitiesDetailedViewModel> GetUserLearningHistoryA
227227
{
228228
var result = await resourceActivityRepository.GetUserLearningHistory(userId, requestModel);
229229

230-
var entrolledCourses = await this.moodleApiService.GetRecentEnrolledCoursesAsync(userId);
230+
var entrolledCourses = await this.moodleApiService.GetEnrolledCoursesHistoryAsync(userId);
231231

232232
List<MyLearningCombinedActivitiesViewModel> mappedMyLearningActivities = new();
233233
List<MyLearningCombinedActivitiesViewModel> mappedEnrolledCourses = new();

WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUserRecentLearningActivities.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
--
66
-- Modification History
77
-------------------------------------------------------------------------------
8-
ALTER PROCEDURE [activity].[GetUserRecentLearningActivities] (
8+
CREATE PROCEDURE [activity].[GetUserRecentLearningActivities] (
99
@userId INT
1010
)
1111
AS

WebAPI/LearningHub.Nhs.Database/Stored Procedures/Activity/GetUsersLearningHistory.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
--
66
-- Modification History
77
-------------------------------------------------------------------------------
8-
ALTER PROCEDURE [activity].[GetUsersLearningHistory] (
8+
CREATE PROCEDURE [activity].[GetUsersLearningHistory] (
99
@userId INT
1010
)
1111
AS

0 commit comments

Comments
 (0)