-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
There was a problem hiding this 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?
Made the changes where able |
There was a problem hiding this 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'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All set @sydneywalcoff
There was a problem hiding this 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 Hmmm I just ran through it and tested every field possible. I didn't encounter this bug anywhere. |
@sydneywalcoff Added an additional helper to capitalize standalone "I" in the LG form fields |
There was a problem hiding this 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!
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.