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

Replace all instances of "report" in Publisher #173

Merged
merged 2 commits into from Nov 23, 2022

Conversation

mxosman
Copy link
Contributor

@mxosman mxosman commented Nov 21, 2022

Description of the change

Replaces all user-facing instances of the word "report" (as outlined in this doc) with relevant replacement constants. There were other components outside of the ones listed in the doc that needed updating - I went through ~60 files that had the word "report" in it, and found some hidden hotspots like toasts/error messages, etc.

If you have a moment, please feel free to test the link below and let me know if there are areas I may have missed!

Demo: https://mahmoudtest---justice-counts-web-qqec6jbn6a-uc.a.run.app/

Related issues

Closes #165

Checklists

Development

This box MUST be checked by the submitter prior to merging:

  • Double- and triple-checked that there is no Personally Identifiable Information (PII) being mistakenly added in this pull request

These boxes should be checked by the submitter prior to merging:

  • Tests have been written to cover the code changed/added as part of this pull request

Code review

These boxes should be checked by reviewers prior to merging:

  • This pull request has a descriptive title and information useful to a reviewer
  • This pull request has been moved out of a Draft state, has no "Work In Progress" label, and has assigned reviewers
  • Potential security implications or infrastructural changes have been considered, if relevant

Reports = "REPORTS",
CreateReport = "CREATE REPORT",
Reports = "RECORDS",
CreateReport = "CREATE RECORD",
Copy link
Contributor Author

@mxosman mxosman Nov 22, 2022

Choose a reason for hiding this comment

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

TypeScript is strict about enums not having computed values - only strings, so I manually updated these.

Screenshot 2022-11-22 at 10 06 15 AM

@mxosman mxosman marked this pull request as ready for review November 22, 2022 16:08
@@ -83,7 +83,7 @@ test("displayed created reports", async () => {
});
});

const annualReport2020 = screen.getByText(/Annual Report FY2020-2021/i);
const annualReport2020 = screen.getByText(/Annual Record FY2020-2021/i);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't do a computed value inside of a regex, so I opted to manually update this one.

@mxosman mxosman requested a review from a team November 22, 2022 16:20
@mxosman mxosman changed the title [WIP] Replace all instances of "report" in Publisher Replace all instances of "report" in Publisher Nov 22, 2022
@mxosman mxosman requested a review from hobuobi November 22, 2022 18:31
Copy link
Contributor

@terryttsai terryttsai left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for going through the whole app!

I'm wondering if it would be worth renaming all our constants / file names to Record instead of Report, so that we don't refer to Report internally but have to remember to say Record externally, or new developers have to learn that Report = Record?

Or maybe it's not worth such a big constant renaming push especially if the name changes again?

export const REPORT_PERIOD_CAPITALIZED = "Time Period";

export const REPORT_LOWERCASE = "record";
export const REPORT_LOWERCASE2 = "share";
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 difference between REPORT_LOWERCASE2, REPORT_VERB_LOWERCASE, GATHER_LOWERCASE? Since they are all defined as "share"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consolidate these constants, like just reuse the share constant instead of create one for GATHER?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea I agree that REPORT_LOWERCASE and REPORT_VERB_LOWERCASE can probably be consolidated? And REPORT_LOWERCASE3 should maybe be REPORT_VERB_LOWERCASE2, and consolidated with GATHER_LOWERCASE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great call! Was super tunnel-visioned here - will consolidate this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cleaned up here: d418ae6

@lilidworkin
Copy link
Collaborator

I'm wondering if it would be worth renaming all our constants / file names to Record instead of Report, so that we don't refer to Report internally but have to remember to say Record externally, or new developers have to learn that Report = Record?

@terryttsai this is a good callout -- @mxosman and I discussed this and I actually suggested keeping the code as Report. It does seem likely/possible that it will change again, and I think it's okay for our code and our internal mental model to stay with "Report". I don't feel strongly and I see the argument both ways, but given how much easier it is to keep as-is, that would be my suggestion.

Copy link
Collaborator

@lilidworkin lilidworkin left a comment

Choose a reason for hiding this comment

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

I went through ~60 files that had the word "report" in it, and found some hidden hotspots like toasts/error messages, etc.

@mxosman that's amazing -- thank you SO MUCH for doing such impressive due diligence!

@mxosman
Copy link
Contributor Author

mxosman commented Nov 22, 2022

I'm wondering if it would be worth renaming all our constants / file names to Record instead of Report, so that we don't refer to Report internally but have to remember to say Record externally, or new developers have to learn that Report = Record?

@terryttsai this is a good callout -- @mxosman and I discussed this and I actually suggested keeping the code as Report. It does seem likely/possible that it will change again, and I think it's okay for our code and our internal mental model to stay with "Report". I don't feel strongly and I see the argument both ways, but given how much easier it is to keep as-is, that would be my suggestion.

Yeah - this was also more/less the quickest solution to unblock Humphrey. I think there is somewhere around 1k instances of "report" to replace - probably best to feel confident that it won't change before fully switching over.

@terryttsai
Copy link
Contributor

Keeping the internal mental model as Report sounds good to me, thanks for explaining the thought process!

@mxosman
Copy link
Contributor Author

mxosman commented Nov 22, 2022

Keeping the internal mental model as Report sounds good to me, thanks for explaining the thought process!

I do think that eventually (once the naming is stable) it would be worth it to rename everything for all the reasons you mentioned!

Copy link
Contributor

@terryttsai terryttsai left a comment

Choose a reason for hiding this comment

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

Looks awesome!

Update all instances of report to the respective constant

Update readme

Fix lint and tests

Spacing issue

Fix spacing

Consolidate constants
@mxosman mxosman merged commit 0d9ae6d into main Nov 23, 2022
@mxosman mxosman deleted the mahmoud/replace-report-text branch November 23, 2022 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace all instances of "report" in Publisher
3 participants