Checking nationality against alpha2 and alpha2. Improved Team Skeet profile scraper.
This commit is contained in:
@@ -332,12 +332,16 @@ async function curateProfile(profile) {
|
||||
if (!curatedProfile.placeOfBirth && curatedProfile.nationality) {
|
||||
const country = await knex('countries')
|
||||
.where('nationality', 'ilike', `%${curatedProfile.nationality}%`)
|
||||
.orWhere('alpha3', 'ilike', `%${curatedProfile.nationality}%`)
|
||||
.orWhere('alpha2', 'ilike', `%${curatedProfile.nationality}%`)
|
||||
.orderBy('priority', 'desc')
|
||||
.first();
|
||||
|
||||
curatedProfile.placeOfBirth = {
|
||||
country: country.alpha2,
|
||||
};
|
||||
if (country) {
|
||||
curatedProfile.placeOfBirth = {
|
||||
country: country.alpha2,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
curatedProfile.social = Array.isArray(profile.social)
|
||||
|
||||
Reference in New Issue
Block a user