Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Update confirmation #2443

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Update confirmation #2443

wants to merge 27 commits into from

Conversation

justinr86
Copy link
Contributor

Fixes #2316

Description

Confirmation summary will indicate which fields have been updated. Links that have been visited will now be displayed in a different colour similarly to other Government of Canada sites.

Any new packages installed?

N/A

Required followup work

N/A

Checklist:

  • I have updated the azurescript.sh with any new environment variables and added them to the appsettings
  • I have looked at my code on GitHub and it all looks good (ex: no random commented out code or console.logs)
  • I have added and needed tests for my changes (in particular for new screens)
  • I have added a comment to any confusing code
  • I have added documentation to any modified front-end code. (Or added missing documentation)

@sastels sastels temporarily deployed to rac-prototyp-update-con-rvfubq October 29, 2020 19:50 Inactive
@sastels sastels temporarily deployed to rac-prototyp-update-con-rvfubq October 29, 2020 19:54 Inactive
@lgtm-com
Copy link

lgtm-com bot commented Oct 29, 2020

This pull request introduces 5 alerts when merging cd0d4e0 into 4e3e45a - view on LGTM.com

new alerts:

  • 5 for Unused variable, import, function or class

@sastels sastels temporarily deployed to rac-prototyp-update-con-rvfubq October 30, 2020 11:24 Inactive
@sastels sastels temporarily deployed to rac-prototyp-update-con-rvfubq October 30, 2020 11:27 Inactive
@ying-chen-cds
Copy link
Contributor

If you click "Edit" and go to a page, do nothing and come back, it shows "Edited", but actually user changed nothing. I don't know if in that case, we should still display "Edited".

@sdzhangtao
Copy link

Here is an easy one.
There are alerts. 5 for Unused variable, import, function or class

@justinr86
Copy link
Contributor Author

If you click "Edit" and go to a page, do nothing and come back, it shows "Edited", but actually user changed nothing. I don't know if in that case, we should still display "Edited".

Yes, this is something I struggled with. How much logic should we use to display this message?

@ngosset @stephaniemgauthier @TarekTraboulsi @barrhayl @Cassista Any thoughts?

Note: the field is only labeled 'Edited' if the user selects the 'Continue' button, selecting 'Go Back' will not label the field 'Edited'.

@justinr86
Copy link
Contributor Author

Here is an easy one.
There are alerts. 5 for Unused variable, import, function or class

Yes, this was resolved in another commit. This causes a failed check due to linting errors. It is now resolved.

/>
</Flex>

{containsData(howdiditstart) ? (
{howdiditstart.howDidTheyReachYou.length ? (

Choose a reason for hiding this comment

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

Is there a reason not to use containsData? It's being used everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

containsData simply checks if the object contains anything. In this case if the field is flagged as edited it will render an empty confirmation summary. This way it will render "No information provided." unless a selection has been made.

label="confirmationPage.ImpactTitle.edit"
path="/whatwasaffected"
edited={impact.edited}
/>
</Flex>
{containsData(impact) ? (

Choose a reason for hiding this comment

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

I know containsData is overly complex. But for string operation, it makes sense to have a check that the string is not empty.
str is not undefined, is not null, size is not zero and doesn't just contain white spaces

Copy link
Contributor

@dengcn dengcn left a comment

Choose a reason for hiding this comment

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

I would recommend to close this PR for now, it touched many files. We may not catch the Azure migration in couple of hours. All the work already in the branch which will go to Azure. Once azure is done, you can recreate PR so have more time to clean up. Rush to master may cause more request coming.

@sdzhangtao
Copy link

The edit link looks good.
But I feel the refactor of containsData should be in a separate PR.
I agree containsData is overly complex. It's overly complex because it's too generic. I am happy to see it refactored based on different data types. Or maybe only stringNotEmpty is required.

@justinr86
Copy link
Contributor Author

The edit link looks good.
But I feel the refactor of containsData should be in a separate PR.
I agree containsData is overly complex. It's overly complex because it's too generic. I am happy to see it refactored based on different data types. Or maybe only stringNotEmpty is required.

containsData has only been replaced where it would cause a blank summary to be displayed. I can change the code to use containsData more specifically if you think that would be more appropriate.

@sdzhangtao
Copy link

The edit link looks good.
But I feel the refactor of containsData should be in a separate PR.
I agree containsData is overly complex. It's overly complex because it's too generic. I am happy to see it refactored based on different data types. Or maybe only stringNotEmpty is required.

containsData has only been replaced where it would cause a blank summary to be displayed. I can change the code to use containsData more specifically if you think that would be more appropriate.

Tha's OK, just feel a bit rushed for a Friday and migration day
I would love to have a separate PR to address this containsData. To be honest I don't like this containsData at all. I think it should be case by case. We use it mostly for string. As for checking an option exist or not. I think your code is a lot easier to read and understand
{containsData(whenDidItHappen) vs {whenDidItHappen.incidentFrequency ?

The latter reads much better.

@justinr86
Copy link
Contributor Author

I will work on an update to evaluate form contents and only mark as edited if the contents are different.

This PR will be left open to collect more feedback.

@ying-chen-cds
Copy link
Contributor

If you click "Edit" and go to a page, do nothing and come back, it shows "Edited", but actually user changed nothing. I don't know if in that case, we should still display "Edited".

Yes, this is something I struggled with. How much logic should we use to display this message?

@ngosset @stephaniemgauthier @TarekTraboulsi @barrhayl @Cassista Any thoughts?

Note: the field is only labeled 'Edited' if the user selects the 'Continue' button, selecting 'Go Back' will not label the field 'Edited'.

If making "Edited" accurately reflects if the form is actually edited or not involves too complicated logic but little business value , maybe turn the link of "Edit" to purple is good enough for now.

@ying-chen-cds
Copy link
Contributor

The edit link looks good.
But I feel the refactor of containsData should be in a separate PR.
I agree containsData is overly complex. It's overly complex because it's too generic. I am happy to see it refactored based on different data types. Or maybe only stringNotEmpty is required.

containsData has only been replaced where it would cause a blank summary to be displayed. I can change the code to use containsData more specifically if you think that would be more appropriate.

Tha's OK, just feel a bit rushed for a Friday and migration day
I would love to have a separate PR to address this containsData. To be honest I don't like this containsData at all. I think it should be case by case. We use it mostly for string. As for checking an option exist or not. I think your code is a lot easier to read and understand
{containsData(whenDidItHappen) vs {whenDidItHappen.incidentFrequency ?

The latter reads much better.

I agree we should have a separate PR to discuss this. If this is the correct way to do things, we should change the logic in PDF report together. After all, this has nothing to with "Edited" function.

@justinr86
Copy link
Contributor Author

The edit link looks good.
But I feel the refactor of containsData should be in a separate PR.
I agree containsData is overly complex. It's overly complex because it's too generic. I am happy to see it refactored based on different data types. Or maybe only stringNotEmpty is required.

containsData has only been replaced where it would cause a blank summary to be displayed. I can change the code to use containsData more specifically if you think that would be more appropriate.

Tha's OK, just feel a bit rushed for a Friday and migration day
I would love to have a separate PR to address this containsData. To be honest I don't like this containsData at all. I think it should be case by case. We use it mostly for string. As for checking an option exist or not. I think your code is a lot easier to read and understand
{containsData(whenDidItHappen) vs {whenDidItHappen.incidentFrequency ?
The latter reads much better.

I agree we should have a separate PR to discuss this. If this is the correct way to do things, we should change the logic in PDF report together. After all, this has nothing to with "Edited" function.

This is related to marking confirmation summaries as edited. containsData will evaluate the object and return true if it contains anything. If an object contains the property edited: true it will display an empty summary.

This code change is limited to the confirmation summaries that will be affected by containsData.

Copy link
Contributor

@DianeLiu2019 DianeLiu2019 left a comment

Choose a reason for hiding this comment

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

all pages works well except anonymous location page. the edit button don't change to purple , and the( Eddited ) don't show up after editing the page

@sdzhangtao sdzhangtao requested review from ying-chen-cds and sdzhangtao and removed request for ying-chen-cds and sdzhangtao October 31, 2020 16:54
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.

Should "edit" link at summary page turn purple if the section associated with that link is modified?
6 participants