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

1363 auto correct form fields #1407

Merged
merged 16 commits into from
Jun 27, 2024
Merged

Conversation

davidwiese
Copy link
Member

Fixes #1363

Changes made

Updated all form inputs to properly capitalize or add punctuation as necessary within the context of the generated form. Tested edge cases as I encountered or thought of them.

Reason for changes

This makes the LG more user friendly, and will require the user to make fewer edits on the preview pages. It will also help prevent their letter from looking unpolished.

@davidwiese davidwiese added the ready for dev lead task ready for dev lead to evaluate label May 22, 2024
@davidwiese davidwiese linked an issue May 22, 2024 that may be closed by this pull request
1 task
Copy link
Member

@sydneywalcoff sydneywalcoff left a comment

Choose a reason for hiding this comment

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

@davidwiese firstly, thank you for fixing that variable typo lol.

secondly, since a lot of the code to check for capitalization/punctuation is the same, can we refactor it into a reusable helper function?

@sydneywalcoff sydneywalcoff removed the ready for dev lead task ready for dev lead to evaluate label May 29, 2024
@davidwiese davidwiese added the ready for dev lead task ready for dev lead to evaluate label Jun 5, 2024
@davidwiese
Copy link
Member Author

@sydneywalcoff

Made the changes where able

Copy link
Member

@sydneywalcoff sydneywalcoff left a comment

Choose a reason for hiding this comment

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

@davidwiese great work! I'd like to turn the 'article' logic into a 'generateArticle' function and add to the helpers. Should be a pretty quick change.

@@ -40,7 +40,10 @@ export function generateInvolvementJob(formState: IStepState): string {
return '';
}

return `I have been working at ${companyName} as a ${jobTitle}. At ${companyName}, ${jobDescription} Having my record cleared would help me continue to advance in my career.`;
// Determine the correct article "a" or "an" based on the first letter of the jobTitle
const article = /^[aeiou]/i.test(jobTitle) ? 'an' : 'a';
Copy link
Member

Choose a reason for hiding this comment

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

lets make a 'generateArticle' helper function too.

Copy link
Member Author

Choose a reason for hiding this comment

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

All set @sydneywalcoff

@sydneywalcoff sydneywalcoff removed the ready for dev lead task ready for dev lead to evaluate label Jun 5, 2024
@davidwiese davidwiese added the ready for dev lead task ready for dev lead to evaluate label Jun 5, 2024
Copy link
Member

@sydneywalcoff sydneywalcoff left a comment

Choose a reason for hiding this comment

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

@davidwiese thank you for making those changes re: refactoring!!

I'm unsure if this bug was present last time I checked and I just missed it, but when running locally, I'm not seeing the Capitalization and Punctuation being implemented on some(but not all) of the textarea components. I noticed it primarily on the ones with (2-3 sentences) in the prompt.

@sydneywalcoff sydneywalcoff removed the ready for dev lead task ready for dev lead to evaluate label Jun 12, 2024
@davidwiese
Copy link
Member Author

@davidwiese thank you for making those changes re: refactoring!!

I'm unsure if this bug was present last time I checked and I just missed it, but when running locally, I'm not seeing the Capitalization and Punctuation being implemented on some(but not all) of the textarea components. I noticed it primarily on the ones with (2-3 sentences) in the prompt.

@sydneywalcoff Hmmm I just ran through it and tested every field possible. I didn't encounter this bug anywhere.

@davidwiese
Copy link
Member Author

@sydneywalcoff Added an additional helper to capitalize standalone "I" in the LG form fields

@davidwiese davidwiese added the ready for dev lead task ready for dev lead to evaluate label Jun 12, 2024
Copy link
Member

@sydneywalcoff sydneywalcoff left a comment

Choose a reason for hiding this comment

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

@davidwiese this looks great! I re-tested it with manually typed answers and it worked perfectly. Eventually we may want to expand this to also apply when the user edits the responses, but for the time being, I think this is wonderful. Thank you for taking this on!

@sydneywalcoff sydneywalcoff merged commit 264a8c1 into dev Jun 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for dev lead task ready for dev lead to evaluate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code auto-correct missing periods and capitalizations
2 participants