-
Notifications
You must be signed in to change notification settings - Fork 1
TD- 5285 retrieve enrolled courses from moodle for user and display in LH #1084
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
Merged
Parent:
Merge RC changes into CI
binon
merged 13 commits into
RC
from
Develop/POC/TD-5285_retrieve_enrolled_courses_from_moodle_for_user
Apr 14, 2025
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c58cfe7
Configure OpenID Connect authentication using the Moodle user ID, ret…
binon 0930d3f
Updated the completion status logic
binon fd2937b
minor tweak on course image display
binon b089d86
exception check
56ff1e2
Added Progress option
bf02e59
Added new feature flag to enable/disable moodle
c352394
Merging RC changes
a43b5cb
Reinstatinmg appsettings
dbe2552
reverting some comented code
4def954
Merging RC chages into TD-5285
af0442e
Missed this file
98e285d
Updated appsetting to reflect RC
bee6cdb
Added moodle invalid user check
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| namespace LearningHub.Nhs.WebUI.Interfaces | ||
| { | ||
| using System.Collections.Generic; | ||
| using System.Threading.Tasks; | ||
| using LearningHub.Nhs.Models.Dashboard; | ||
| using LearningHub.Nhs.WebUI.Models; | ||
|
|
||
| /// <summary> | ||
| /// IMoodleApiService. | ||
| /// </summary> | ||
| public interface IMoodleApiService | ||
| { | ||
| /// <summary> | ||
| /// GetEnrolledCoursesAsync. | ||
| /// </summary> | ||
| /// <param name="currentUserId">Moodle user id.</param> | ||
| /// <param name="pageNumber">pageNumber.</param> | ||
| /// <returns> List of MoodleCourseResponseViewModel.</returns> | ||
| Task<List<MoodleCourseResponseViewModel>> GetEnrolledCoursesAsync(int currentUserId, int pageNumber); | ||
|
|
||
| /// <summary> | ||
| /// GetEnrolledCoursesAsync. | ||
| /// </summary> | ||
| /// <param name="userId">Moodle user id.</param> | ||
| /// <param name="courseId">Moodle course id.</param> | ||
| /// <param name="pageNumber">pageNumber.</param> | ||
| /// <returns> List of MoodleCourseResponseViewModel.</returns> | ||
| Task<MoodleCourseCompletionViewModel> GetCourseCompletionAsync(int userId, int courseId, int pageNumber); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| namespace LearningHub.Nhs.Services.Interface | ||
| { | ||
| using System.Net.Http; | ||
| using System.Threading.Tasks; | ||
|
|
||
| /// <summary> | ||
| /// The Moodle Http Client interface. | ||
| /// </summary> | ||
| public interface IMoodleHttpClient | ||
| { | ||
| /// <summary> | ||
| /// The get cient async. | ||
| /// </summary> | ||
| /// <returns>The <see cref="Task"/>.</returns> | ||
| Task<HttpClient> GetClient(); | ||
|
|
||
| /// <summary> | ||
| /// GetDefaultParameters. | ||
| /// </summary> | ||
| /// <returns>defaultParameters.</returns> | ||
| string GetDefaultParameters(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
LearningHub.Nhs.WebUI/Models/MoodleCompletionResponseViewModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| namespace LearningHub.Nhs.WebUI.Models | ||
| { | ||
| /// <summary> | ||
| /// MoodleCompletionResponseViewModel. | ||
| /// </summary> | ||
| public class MoodleCompletionResponseViewModel | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the completion status. | ||
| /// </summary> | ||
| public string Exception { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets error code. | ||
| /// </summary> | ||
| public string Errorcode { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets Error message. | ||
| /// </summary> | ||
| public string Message { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets Debug info. | ||
| /// </summary> | ||
| public string Debuginfo { get; set; } | ||
| } | ||
| } |
103 changes: 103 additions & 0 deletions
103
LearningHub.Nhs.WebUI/Models/MoodleCourseCompletionViewModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| namespace LearningHub.Nhs.WebUI.Models | ||
| { | ||
| using System.Collections.Generic; | ||
|
|
||
| /// <summary> | ||
| /// MoodleCourseCompletionViewModel. | ||
| /// </summary> | ||
| public class MoodleCourseCompletionViewModel | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the completion status. | ||
| /// </summary> | ||
| public CompletStatus CompletionStatus { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the list of warnings. | ||
| /// </summary> | ||
| public List<object> Warnings { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// CompletionStatus. | ||
| /// </summary> | ||
| public class CompletStatus | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets a value indicating whether the course is completed. | ||
| /// </summary> | ||
| public bool Completed { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the aggregation method. | ||
| /// </summary> | ||
| public int Aggregation { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the list of completions. | ||
| /// </summary> | ||
| public List<Completion> Completions { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Completion. | ||
| /// </summary> | ||
| public class Completion | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the type of completion. | ||
| /// </summary> | ||
| public int Type { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the title of the completion requirement. | ||
| /// </summary> | ||
| public string Title { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the status of the completion. | ||
| /// </summary> | ||
| public string Status { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets a value indicating whether the requirement is complete. | ||
| /// </summary> | ||
| public bool Complete { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the timestamp when completion was achieved. | ||
| /// </summary> | ||
| public long? TimeCompleted { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the completion details. | ||
| /// </summary> | ||
| public CompletionDetails Details { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// CompletionDetails. | ||
| /// </summary> | ||
| public class CompletionDetails | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the type of completion requirement. | ||
| /// </summary> | ||
| public string Type { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the criteria for completion. | ||
| /// </summary> | ||
| public string Criteria { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the requirement for completion. | ||
| /// </summary> | ||
| public string Requirement { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the status of the requirement. | ||
| /// </summary> | ||
| public string Status { get; set; } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this model class to LH Model Repo?