-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#13104] Accounts request form: auto-unify country names #13117
Changes from 3 commits
d9644b1
b9bc5d3
b9793d0
8f0f807
fb8190a
a1353c3
1cb20d4
4162aea
5530a1e
c93528d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,10 +116,20 @@ export class InstructorRequestFormComponent { | |
const email = this.email.value!.trim(); | ||
const comments = this.comments.value!.trim(); | ||
|
||
// Country Mapping | ||
const countryMapping: { [key: string]: string } = { | ||
'United States': 'USA', | ||
US: 'USA', | ||
America: 'USA', | ||
UK: 'United Kingdom', | ||
Deutschland: 'Germany', | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like there is a better place to put this. I am not completely sure where though; perhaps another reviewer has a better idea. However, maybe at the very least, it should be outside the function, like maybe it should be a class constant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of creating another class so that the map can only be accessed with a method and cannot be modified, but I'm not sure if it's the correct apporach. |
||
|
||
// Combine country and institution | ||
const country = this.country.value!.trim(); | ||
const mappedCountry = countryMapping[country] || country; | ||
const institution = this.institution.value!.trim(); | ||
const combinedInstitution = `${institution}, ${country}`; | ||
const combinedInstitution = `${institution}, ${mappedCountry}`; | ||
|
||
const requestData: AccountCreateRequest = { | ||
instructorEmail: email, | ||
|
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.
Are these the only possibilities?
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.
I added some countries to the list with the change in the issue, and also included the possibility to correct any capitalization typos in the listed countries.