Skip to content
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

Add support for Primary education phase #1326

Merged
merged 2 commits into from
Dec 7, 2023
Merged

Conversation

martyn-w
Copy link
Contributor

@martyn-w martyn-w commented Dec 4, 2023

New (optional) StageTaughtId parameter + updated tests

This adds support for an improved RTTA process to capture interest in primary stage teaching

Requires changes to be pulled through into https://github.com/DFE-Digital/get-into-teaching-api-ruby-client and https://github.com/DFE-Digital/get-into-teaching-api-csharp-client

New (optional) StageTaughtId parameter
+ updated tests
Copy link

sonarqubecloud bot commented Dec 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

96.3% 96.3% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

Copy link
Collaborator

@asatwal asatwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few questions. Some of them for my understanding also :-)

@@ -81,12 +82,12 @@ public class TeachingEventsController : ControllerBase
var typeIds = request.TypeIds == null ? string.Empty : string.Join(",", request.TypeIds);

_metrics.TeachingEventSearchResults
.WithLabels(typeIds, request.Radius.ToString())
.WithLabels(typeIds, String.Format(CultureInfo.InvariantCulture, "{0}", request.Radius))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my info, why has String.Format(CultureInfo.InvariantCulture, "{0}" been added ? Seems unrelated to the change in this PR. Might just be my understanding !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this change is unrelated to this issue; the change was flagged by the code linter:

using Radius.ToString() does not guarantee the format of the integer->string conversion, it could vary with culture.

Using String.Format with an invariant culture guarantees the format of the string. Its a very minor issue, but one the linter flagged 🤷

candidate.PastTeachingPositions.Add(new CandidatePastTeachingPosition()
{
Id = PastTeachingPositionId,
SubjectTaughtId = SubjectTaughtId,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a Typo ? It looks like self assignment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, you are right, sorry for that - this line is not required. I'll push an update shortly. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asatwal actually, on reflection (and tests) - this parameter SubjectTaughtId is required. Its part of the initialisation of the CandidatePastTeachingPosition instance:

new CandidatePastTeachingPosition()
                    {
                        Id = PastTeachingPositionId,
                        SubjectTaughtId = SubjectTaughtId,
                        EducationPhaseId = (int)CandidatePastTeachingPosition.EducationPhase.Secondary,
                    }

which translates to create a new CandidatePastTeachingPosition instance setting it's SubjectTaughtId to the request's SubjectTaughtId. I agree its not terribly clear... but that is the c# syntax.

Copy link
Collaborator

@asatwal asatwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@martyn-w martyn-w merged commit 0732742 into master Dec 7, 2023
12 of 13 checks passed
@martyn-w martyn-w deleted the rtta-primary-support branch December 7, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VisualCSharp Visual C #
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants