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

RAS-940: Questionnaire Completion Rate Information #288

Merged

Conversation

SteveScorfield
Copy link
Contributor

@SteveScorfield SteveScorfield commented Jan 29, 2024

What and why?

There is a requirement to add a datetime for when a respondents status is changed and to display this in the Response Chasing Report. This PR includes the code change to add the timedate to the Casegroup table.

How to test?

Deploy this PR and update the status of a respondent (either via Frontstage or in rOps) and click the report for the associated survey. This will show the datetime of the status change within the Casegroup table.
Check the unit tests work and that the acceptance tests still work.
For completeness, deploy ONSdigital/rm-reporting#110 and follow it's test instructions.

Jira

https://jira.ons.gov.uk/browse/RAS-940

@SteveScorfield
Copy link
Contributor Author

/deploy scorfs

@ras-rm-pr-bot
Copy link
Collaborator

Deploying to dev cluster with following parameters:

  • namespace: scorfs

  • tag: pr-288

  • configBranch: main

  • paramKey: ``

  • paramValue: ``

@SteveScorfield
Copy link
Contributor Author

/deploy scorfs

@ras-rm-pr-bot
Copy link
Collaborator

Deploying to dev cluster with following parameters:

  • namespace: scorfs

  • tag: pr-288

  • configBranch: main

  • paramKey: ``

  • paramValue: ``

Copy link
Contributor

@LJBabbage LJBabbage left a comment

Choose a reason for hiding this comment

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

I know the tests are a bit simplistic in this service, not expecting huge things, but a tweak at minimum would be good. There was a suggestion of having a trigger in the db doing the update, I don't personally think we need it, but another dev might think otherwise

@@ -61,4 +62,7 @@ public class CaseGroup implements Serializable {
@Enumerated(EnumType.STRING)
@Column(name = "status")
private CaseGroupStatus status;

@Column(name = "change_state_timestamp")
Copy link
Contributor

Choose a reason for hiding this comment

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

Slightly strange name, I would expect it to align with the column? Isn't that status, I also find it more palatable flipping the words, so something like status_change_timestamp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I've renamed it.

@@ -23,7 +22,7 @@ public void updateAuditTable(final CaseGroup caseGroup, final UUID partyId) {
auditEntity.setCaseGroupFK(caseGroup.getCaseGroupPK());
auditEntity.setStatus(caseGroup.getStatus());
auditEntity.setPartyId(partyId);
auditEntity.setCreatedDateTime(DateTimeUtil.nowUTC());
auditEntity.setCreatedDateTime(caseGroup.getChangeStateTimestamp());
Copy link
Contributor

Choose a reason for hiding this comment

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

Not convinced we use this table for anything, but right to update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe it is but I thought for the sake on continuity to update it.

@SteveScorfield
Copy link
Contributor Author

/deploy scorfs

@ras-rm-pr-bot
Copy link
Collaborator

Deploying to dev cluster with following parameters:

  • namespace: scorfs

  • tag: pr-288

  • configBranch: main

  • paramKey: ``

  • paramValue: ``

@matthew-robinson-ons
Copy link
Contributor

/deploy robinm3

@ras-rm-pr-bot
Copy link
Collaborator

Deploying to dev cluster with following parameters:

  • namespace: robinm3

  • tag: pr-288

  • configBranch: main

  • paramKey: ``

  • paramValue: ``

Copy link
Contributor

@matthew-robinson-ons matthew-robinson-ons left a comment

Choose a reason for hiding this comment

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

All looks good functionally, agree with the comment about adding some test changes as well.

@SteveScorfield
Copy link
Contributor Author

SteveScorfield commented Feb 5, 2024

@LJBabbage I agree the tests need adding. I have added one to cover the adding of a datetimestamp after transitioning status.

@@ -6,6 +6,7 @@
import static org.mockito.Mockito.verify;

import java.util.*;
import org.junit.Assert;
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 3 brings in all the asserts

@@ -90,6 +93,7 @@ public void givenCaseGroupStatusWhenCaseGroupStatusTransitionedThenTransitionIsA
caseGroupService.transitionCaseGroupStatus(caseGroup, categoryName, caseGroup.getPartyId());

// Then

Copy link
Contributor

Choose a reason for hiding this comment

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

extra line?

@@ -64,6 +65,8 @@ public void givenCaseGroupStatusWhenCaseGroupStatusTransitionedThenTransitionIsS
caseGroupService.transitionCaseGroupStatus(caseGroup, categoryName, caseGroup.getPartyId());

// Then
Assert.assertNotNull(caseGroup.getStatusChangeTimestamp());
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe change the name of this test to not be so rubbish, I know you didn't do it originally

Copy link
Contributor

@matthew-robinson-ons matthew-robinson-ons left a comment

Choose a reason for hiding this comment

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

Looks good now with the test changes

@SteveScorfield SteveScorfield merged commit d4d13dd into main Feb 5, 2024
1 check passed
@SteveScorfield SteveScorfield deleted the add-timestamp-for-status-change-on-questionnaire branch February 5, 2024 16:05
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