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

Optionally add reason when completing action #543

Merged
merged 5 commits into from
Sep 2, 2021

Conversation

denektenina
Copy link
Contributor

@denektenina denektenina commented Aug 17, 2021

Context: Users of BMT have asked for a feature where they can provide a reason when completing an action. After having talked with the customer, we now have the following solution for the frontend. In addition, the team decided to add a new table, called closingRemarks, so that we have a way of separating notes and closing remarks in case this is needed in the future. This PR is now using the new end point for closing remarks when saving.

Solution in steps:

  1. An incomplete action looks like this in the edit action panel:

image

  1. The user clicks the "Complete action"-button at the bottom to complete the action. A text field and confirm buttons appears. Nothing is saved until the user clicks "confirm".

image

  1. Regardless of whether or not the user writes a text before clicking "confirm" - a closingRemark will be saved. If it is empty, the notes list will show the empty comment:

image

  1. If the user writes a text, the text will also be in the list:

image

  1. To save the complete-status and to save the closingRemark, we have to perform two mutations. The second one is only done after the first has completed successfully. If one of the two calls fail, one of the following error displays will be shown:

a) If saving complete-status fails - shows the same error display as if saving any other fields on the action fails (has been moved from top of form to bottom):

image

b) If saving closingRemark fails - shows a different error in almost the same place:

image

Comments / Improvements:

  • The closing comments are no longer prefixed with the text "Action completed: " or "Action un-completed", as this is not necessary now that we have a separate type for these comments.
  • It is no longer possible to re-open a closed action. This is why we are now using a button at the bottom and not a switch or checkbox.
  • If the user receives an error on saving closing remark, they may be confused about what failed: is the action completed or not?
  • I have now added a background color to the closing comment
  • When an action is successfully completed, this is shown at the top of the view with a check mark:

image

@denektenina denektenina linked an issue Aug 17, 2021 that may be closed by this pull request
@denektenina denektenina self-assigned this Aug 17, 2021
@denektenina denektenina requested a review from achaikou August 17, 2021 15:13
@denektenina denektenina marked this pull request as draft August 20, 2021 08:00
@lightenup lightenup removed the blocked label Aug 26, 2021
@denektenina denektenina marked this pull request as ready for review August 27, 2021 06:37
@denektenina denektenina requested a review from maiaht August 27, 2021 06:44
Copy link
Contributor

@maiaht maiaht left a comment

Choose a reason for hiding this comment

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

It seems like the text box for the closing remark is placed too far to the left compared to the other elements in the side panel.

I also have a suggestion:
If you have set the switch to completed, and then change your mind such that you don't want to add a closing remark and set the switch back to in-completed, then perhaps the text box can disappear? So, to sum up, if the text box is empty and the switch is changed from complete to in-complete, then the text box should disappear.

@ReedOnly
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

})
}

it('Action can be completed without writing a reason', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify with customer if this is possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was possible until yesterday, but now it seems it should be mandatory, so I think I will change it (checking with Andreas first)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided in daily standup that we will merge this as it is and fix the change as a new feature if they want to make it mandatory

@@ -288,6 +365,34 @@ const createEditSeed = () => {
return { seed, existingAction, existingNotes }
}

const createCompleteActionSeed = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid coupling initial state to actual test case. This almost does the same as createEditSeed. It is better to create an evaluation that has actions , k.e. createEvaluationWithSomeActions and pass completeState as optional parameter (if not set randomize as is now) - this can then be used in all testcases, see #586

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Fixed now.

Copy link
Contributor

@maiaht maiaht left a comment

Choose a reason for hiding this comment

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

The EvaluationGQL.ts file is now an empty file, but it should be deleted

@denektenina denektenina requested a review from maiaht September 2, 2021 09:21
Copy link
Contributor

@petterwildhagen petterwildhagen left a comment

Choose a reason for hiding this comment

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

Nice refactoring of setup of initial state.

@denektenina denektenina merged commit 0387b14 into equinor:master Sep 2, 2021
@denektenina denektenina deleted the completed_reason branch September 2, 2021 09:37
Copy link
Contributor

@achaikou achaikou left a comment

Choose a reason for hiding this comment

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

🐌 [world's fastest delivery service] Review started yesterday has arrived! 🐌
Nothing critical, so just take a look if there is something that is worth fixing in the next PR.

@@ -39,8 +52,9 @@ const ActionEditForm = ({ action, connectedQuestion, possibleAssignees, possible
const [dueDate, setDueDate] = useState<Date>(new Date(action.dueDate))
const [priority, setPriority] = useState<Priority>(action.priority)
const [description, setDescription] = useState<string>(action.description)
const [onHold, setOnHold] = useState<boolean>(action.onHold)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should "onHold" be removed from backend?

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 guess that's something for the team to discuss

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.

#21.A Set a ´lukketekst´ when closing an action.
6 participants