Skip to content

Conversation

@DanBloxham-sw
Copy link
Contributor

@DanBloxham-sw DanBloxham-sw commented Jun 16, 2022

JIRA link

https://softwiretech.atlassian.net/browse/HEEDLS-412

Description

New tracker endpoint StoreAspAssessNoSession. Some minor renaming/refactoring of related methods has also been performed.

As part of this, the StoreAspProgressService was renamed to StoreAspService as it contains methods used across StoreAspProgress and StoreAspAssess tracker endpoints. A similar renaming was performed on the test file for this service. It looks like GitHub hasn't compared the details effectively, and considers the old file deleted. So there are a few changes in each which aren't actually changed.

Screenshots

N/A


Developer checks

(Leave tasks unticked if they haven't been appropriate for your ticket.)

I have:

  • Run the formatter and made sure there are no IDE errors.
  • Written tests for the changes (accessibility tests, unit tests for controller, data services, services, view models, etc)
  • Manually tested my work with and without JavaScript. Full manual testing guidelines can be found here: https://softwiretech.atlassian.net/wiki/spaces/HEE/pages/6703648740/Testing
  • Updated/added documentation in Swiki and/or Readme. Links (if any) are below:
  • Updated my Jira ticket with information about other parts of the system that were touched as part of the MR and have to be sanity tested to ensure nothing’s broken.
  • Scanned over my own MR to ensure everything is as expected.

Copy link
Contributor

@AlexJacksonDS AlexJacksonDS left a comment

Choose a reason for hiding this comment

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

I think this all looks fine

@simonbrent
Copy link
Contributor

It looks like GitHub hasn't compared the details effectively, and considers the old file deleted

For reference, this is a git issue, not a github issue, and can be resolved on the command line as follows:

git diff master -M01 -- DigitalLearningSolutions.Data/Services/StoreAspProgressService.cs DigitalLearningSolutions.Data/Services/StoreAspService.cs

(http://git-scm.com/docs/git-diff#Documentation/git-diff.txt--Mltngt)

public static readonly TrackerEndpointResponse NullTutorialStatusOrTime =
new TrackerEndpointResponse(-14, nameof(NullTutorialStatusOrTime));
public static readonly TrackerEndpointResponse StoreAspAssessException =
new TrackerEndpointResponse(-6, nameof(StoreAspAssessException));
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the deal with these negative ids?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the process is complete, we expect the tracker endpoint to return some text in the format of
"[#Result:1]"
If the process errors, we expect to return a similar output along the lines of
"[#Result:{errorCode}]"
where the errorCode is a specific number. These error codes are all negative to indicate the a problem occurred. Hence we save the IDs of each of these as negative so we can easily return the right code from the enum.
Why the numbers are what they are, I am unsure. But I believe these tracker endpoints are all used in Learning Hub, which will expect specific results in specific circumstances - I am unsure how they will behave if any of this changed. But what we have here more or less emulates the old code.

.MustHaveHappenedOnceExactly();
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It'd have been easier to review this file if the GetProgressAndValidateInputsForStoreAspAssess and GetProgressAndValidateCommonInputsForStoreAspProgressEndpoints tests were grouped separately, rather than interspersed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I realise that mistake now. I was trying to go with "near identical tests for different methods are together" that would make the whole file easier to understand, but from a comparison perspective it ends up worse. I've left them how they were for now so comparing between commits should be simple.


[Test]
public void
GetProgressAndValidateCommonInputsForStoreAspProgressEndpoints_returns_progress_record_and_null_exception_when_all_is_valid()
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of null_exception, I'd prefer either no_exception or null_validationResponse, since I immediately thought: "Is a null exception like Java's null pointer exception?"

Note: there are numerous other tests with this naming convention both in this file and in TrackerActionServiceTests

private void StoreAspProgressServiceReturnsDefaultDetailedCourseProgressOnValidation()
[Test]
public void
StoreAspAssessNoSession_returns_non_null_exception_from_query_param_and_progress_validation()
Copy link
Contributor

Choose a reason for hiding this comment

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

"non null exception" = "an exception"?

Copy link
Contributor

@AlexJacksonDS AlexJacksonDS left a comment

Choose a reason for hiding this comment

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

Unit test names look fine now, just need to reorganise them before merging.

@DanBloxham-sw DanBloxham-sw merged commit cf5c03f into master Jun 20, 2022
@DanBloxham-sw DanBloxham-sw deleted the HEEDLS-412-StoreASPAssessNoSession branch June 20, 2022 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants