-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore: split QualificationDetailsController.cs #479
Open
ThomasWhittington
wants to merge
8
commits into
release/02-Dec-24-R1
Choose a base branch
from
chore/qualification-details-refactor
base: release/02-Dec-24-R1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e51a6df
chore: split QualificationDetailsController.cs into a new Qualificati…
ThomasWhittington 4d96c51
chore: refactor of QualificationSearchController.cs into Qualificatio…
ThomasWhittington a73bcec
chore: cleanup of BasicQualificationModel.cs
ThomasWhittington 11eeb1b
chore: updated branch to latest
ThomasWhittington 915b319
chore: removed duplicate method
ThomasWhittington 09ff0d0
chore: rejigged all tests to fit new service structure
ThomasWhittington 75a28cc
chore: Updated branch
ThomasWhittington 382ba63
chore: made some methods private
ThomasWhittington 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 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
530 changes: 38 additions & 492 deletions
530
src/Dfe.EarlyYearsQualification.Web/Controllers/QualificationDetailsController.cs
Large diffs are not rendered by default.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/Dfe.EarlyYearsQualification.Web/Controllers/QualificationSearchController.cs
This file contains 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,40 @@ | ||
using Dfe.EarlyYearsQualification.Web.Attributes; | ||
using Dfe.EarlyYearsQualification.Web.Controllers.Base; | ||
using Dfe.EarlyYearsQualification.Web.Services.QualificationSearch; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Dfe.EarlyYearsQualification.Web.Controllers; | ||
|
||
[Route("/qualifications")] | ||
[RedirectIfDateMissing] | ||
public class QualificationSearchController( | ||
ILogger<QualificationSearchController> logger, | ||
IQualificationSearchService qualificationSearchService) | ||
: ServiceController | ||
{ | ||
[HttpGet] | ||
public async Task<IActionResult> Get() | ||
{ | ||
var qualifications = await qualificationSearchService.GetQualifications(); | ||
if (qualifications is null) | ||
{ | ||
logger.LogError("No content for the qualification list page"); | ||
return RedirectToAction("Index", "Error"); | ||
} | ||
|
||
return View(qualifications); | ||
} | ||
|
||
[HttpPost] | ||
public IActionResult Refine(string? refineSearch) | ||
{ | ||
if (!ModelState.IsValid) | ||
{ | ||
logger.LogWarning($"Invalid model state in {nameof(QualificationSearchController)} POST"); | ||
} | ||
|
||
qualificationSearchService.Refine(refineSearch ?? string.Empty); | ||
|
||
return RedirectToAction("Get"); | ||
} | ||
} |
This file contains 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
20 changes: 17 additions & 3 deletions
20
src/Dfe.EarlyYearsQualification.Web/Models/Content/BasicQualificationModel.cs
This file contains 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 |
---|---|---|
@@ -1,12 +1,26 @@ | ||
using Dfe.EarlyYearsQualification.Content.Entities; | ||
|
||
namespace Dfe.EarlyYearsQualification.Web.Models.Content; | ||
|
||
public class BasicQualificationModel | ||
{ | ||
protected BasicQualificationModel() | ||
{ | ||
} | ||
|
||
public BasicQualificationModel(Qualification qualification) | ||
{ | ||
QualificationId = qualification.QualificationId; | ||
QualificationLevel = qualification.QualificationLevel; | ||
QualificationName = qualification.QualificationName; | ||
AwardingOrganisationTitle = qualification.AwardingOrganisationTitle; | ||
} | ||
|
||
public string QualificationId { get; init; } = string.Empty; | ||
|
||
public string QualificationName { get; init; } = string.Empty; | ||
|
||
public string AwardingOrganisationTitle { get; init; } = string.Empty; | ||
|
||
public int QualificationLevel { get; init; } | ||
} |
This file contains 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
24 changes: 24 additions & 0 deletions
24
...EarlyYearsQualification.Web/Services/QualificationDetails/IQualificationDetailsService.cs
This file contains 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,24 @@ | ||
using Dfe.EarlyYearsQualification.Content.Entities; | ||
using Dfe.EarlyYearsQualification.Web.Models.Content; | ||
|
||
namespace Dfe.EarlyYearsQualification.Web.Services.QualificationDetails; | ||
|
||
public interface IQualificationDetailsService | ||
{ | ||
Task<Qualification?> GetQualification(string qualificationId); | ||
Task<DetailsPage?> GetDetailsPage(); | ||
bool HasStartDate(); | ||
Task<string?> GetFeedbackBannerBodyToHtml(FeedbackBanner? feedbackBanner); | ||
bool QualificationContainsQtsQuestion(Qualification qualification); | ||
bool UserAnswerMatchesQtsQuestionAnswerToBeFullAndRelevant(Qualification qualification, List<AdditionalRequirementAnswerModel>? additionalRequirementAnswerModels); | ||
bool AnswersIndicateNotFullAndRelevant(List<AdditionalRequirementAnswerModel> additionalRequirementsAnswers); | ||
RatioRequirementModel MarkAsNotFullAndRelevant(RatioRequirementModel model); | ||
Task QualificationLevel3OrAboveMightBeRelevantAtLevel2(QualificationDetailsModel model, Qualification qualification); | ||
Task CheckRatioRequirements(Qualification qualification, QualificationDetailsModel model); | ||
(bool isFullAndRelevant, QualificationDetailsModel details) RemainingAnswersIndicateFullAndRelevant(QualificationDetailsModel details, AdditionalRequirementQuestion qtsQuestion); | ||
Task<QualificationDetailsModel> CheckLevel6Requirements(Qualification qualification, QualificationDetailsModel details); | ||
bool DoAdditionalAnswersMatchQuestions(QualificationDetailsModel details); | ||
NavigationLink? CalculateBackButton(DetailsPage content, string qualificationId); | ||
List<AdditionalRequirementAnswerModel>? MapAdditionalRequirementAnswers(List<AdditionalRequirementQuestion>? additionalRequirementQuestions); | ||
Task<QualificationDetailsModel> MapDetails(Qualification qualification, DetailsPage content); | ||
} |
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.
I'm in two minds about these ones. I wonder if they should be moved out of this service, then the service only focuses on the mapping etc. of qualification data?