Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Conversation

@mBoegvald
Copy link
Collaborator

This is not thoroughly tested, but this is at least a first iteration of the new task-type.

@mBoegvald mBoegvald self-assigned this Nov 23, 2021
@mBoegvald mBoegvald force-pushed the change/46800_webform_inherit_task_type branch from 62a1f84 to 867db77 Compare November 24, 2021 12:07
@mBoegvald
Copy link
Collaborator Author

This MR is ready for review i'd say.

@agger-magenta
Copy link
Contributor

I'll look at it then!

Copy link
Contributor

@agger-magenta agger-magenta left a comment

Choose a reason for hiding this comment

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

Nogle få kommentarer, generelt ser det fint ud!

@mBoegvald mBoegvald force-pushed the change/46800_webform_inherit_task_type branch from 867db77 to e179ae4 Compare November 25, 2021 10:49
@mBoegvald
Copy link
Collaborator Author

The PR has been updated with the mentioned improvements, I'm removing the Draft status and await final approval.

I have attached the flow and the webforms I've used to test it.

Hjemmearbejde_flow.txt
Aftale om hjemmearbejde.txt
Aftale om hjemmearbejde - samlet leder.txt
Aftale om hjemmearbejde - samlet leder 2.txt
Aftale om hjemmearbejde - AMR vurdering.txt

@mBoegvald mBoegvald marked this pull request as ready for review November 25, 2021 11:04
@agger-magenta
Copy link
Contributor

Ja, nu ser det godt ud!

@mBoegvald mBoegvald requested a review from lats1 November 25, 2021 13:06
Copy link
Collaborator

@rimi-itk rimi-itk 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. A few changes are required. Note that I've added a comment on line 108, but this comment is hidden inside the previously resolved conversation on this line.

@mBoegvald mBoegvald force-pushed the change/46800_webform_inherit_task_type branch from e179ae4 to 991b561 Compare November 26, 2021 08:45
Copy link
Collaborator

@rimi-itk rimi-itk left a comment

Choose a reason for hiding this comment

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

I missed the missing error handling in my first review.

Please don't force push changes! This makes it harder to review changes.

Comment on lines 108 to 114
if (!isset($webform_submission)) {
\Drupal::logger('os2forms_forloeb')->error(
"Predecessors must have submissions with webforms attached."
);
}
// Copy the fields of the webform submission to the values array.
foreach ($webform_submission->getData() as $key => $value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to handle the case when $webform_submission is not set, i.e. by returning early. Just logging the error is not enough.

Copy link
Collaborator Author

@mBoegvald mBoegvald Nov 26, 2021

Choose a reason for hiding this comment

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

I changed line 109-111 to:
\Drupal::logger('os2forms_forloeb')->error( "Predecessors must have submissions with webforms attached." ); return FALSE

I'm wondering in which scenario we would use this task-type without having a submission. I don't see how we would ever get to an WebformInheritTask without having posted a submission earlier in the flow (as the whole functionality of this task-type is to get earlier submission's data).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you're missing a git push

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, sorry. I haven't pushed yet, I didn't test it before writing the comment, so it got a bit delayed, my bad.

@mBoegvald mBoegvald merged commit 5773ad5 into develop Nov 26, 2021
@mBoegvald mBoegvald deleted the change/46800_webform_inherit_task_type branch November 26, 2021 11:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants