IFRCGo / go-frontend

MIT License
21 stars 5 forks source link

[PROD] Repetitive entries in NS dropdown on signup page #1936

Closed esario closed 3 years ago

esario commented 3 years ago

Issue

Multiple NS appear multiple times on the NS dropdown list when creating a new user account.

Steps to reproduce

image

Expected behaviour

Each NS should appear only once on the list.

Related feature

Could this be related to those NS having multiple admin regions, e.g. Australian RC has Australia and Tasmania, American RC and French RC have overseas territories, etc.

Impact

People signing up.

Severity

Cosmetic.

Is there a workaround?

None identified.

batpad commented 3 years ago

cc @jhenshall @geohacker @frozenhelium

Country filters strike again! I think this is because there are a bunch of non-independent countries that have the same National Society name and we are not filtering out non-independent countries here? @jhenshall so now we have at least these two lists where we need to (re)define exactly what logic to use to display in the dropdown:

This seems like a bit of a critical issue, and if this is a very straightforward fix, I might be tempted to recommend a hotfix here.

cc @tovari

jhenshall commented 3 years ago
Logic should be: Page Dropdown name DB field name Record type = Independent = Disputed = Notes
User registration Organization Name (when Org Type = NS) society_name 1 (country) TRUE -  

As outlined in #1997

szabozoltan69 commented 3 years ago

https://github.com/IFRCGo/go-frontend/pull/2002 fixes this.

szabozoltan69 commented 3 years ago

(There are 13 registrations of the last few months, where the country points to not-independent area (Aruba, Anguilla, Bermuda). We could update them with:

           -- id 3: United Kingdom
update api_profile set country_id=3, org = 'British Red Cross' 
where country_id in (217, 233);
            -- id 124: Netherlands
update api_profile set country_id=124, org = 'The Netherlands Red Cross'
where country_id in (231);

)

batpad commented 3 years ago

Fix for this is now on staging, cc @esario @jhenshall - thank you @szabozoltan69 !

@szabozoltan69 the update on the db to "fix" registrations that may have occured in the past months and point to the wrong country in the database, that looks good to me. Let's wait for @jhenshall to be back to confirm the logic before we run it though - I think it is okay if that waits a week or so.

jhenshall commented 3 years ago

Amazing, thanks @szabozoltan69 @batpad ! Logic sounds good to me.

As discussed on call, but to clarify here. We will only be changing the records where the 'Organisation Name' is linked to a non-independent country, not the field for users' country of residence.

e.g. a user could have country = Anguilla but will be organisation = United Kingdom (for British Red Cross)

Where organisation is taken from non-independent country, the sovereign_state field in country database to be used to link to correct NS country. Thanks!

szabozoltan69 commented 3 years ago

This is the logic, ok!

szabozoltan69 commented 3 years ago

Recently here are the 13 cases. In some of them the organization is set quite properly, showing the sophisticated situation. Shall I overwrite them?

select c.id, c.name,org,org_type,department 
from api_profile p join api_country c on c.id=p.country_id
where user_id in (select p.user_id 
from api_profile p 
join api_country c on c.id = p.country_id
where not c.independent) order by 1;

id  |   name   |                          org                     | org_type |             department             
----+----------+--------------------------------------------------+----------+-----------------------
217 | Anguilla | Programme Officer                                    | NTLS | Disaster Preparedness and Rsp.
217 | Anguilla | Anguilla Red Cross (Branch of the British Red Cross) | NTLS | Anguilla Branch
231 | Aruba    | OSB                                                  | NTLS | RED CROSS ARUBA
231 | Aruba    | Red Cross                                            | NTLS | Red Cross
231 | Aruba    | OSB                                                  | NTLS | NR EMT
231 | Aruba    | The Netherlands Red Cross OSB Aruba                  | NTLS | NIT& VCA member
231 | Aruba    | Red cross Aruba                                      | OTHR | 
231 | Aruba    | OSB Netherlands Red Cross                            | NTLS | Marketing & Operations
231 | Aruba    | The Netherlands Red Cross OSB Aruba                  | NTLS | NIT& VCA member
231 | Aruba    | Netherlands Red Cross Chapter Aruba                  | NTLS | Volunteers 
231 | Aruba    | Red Cross Aruba                                      | NTLS | Red Cross
233 | Bermuda  | Overseas Branch of National Society                  | NTLS | Disaster Management
233 | Bermuda  | Bermuda Red Cross/OSB                                | NTLS | Health, Safety & Disaster Srv.
(13 rows)
szabozoltan69 commented 3 years ago

Then we should not update anything, organization can remain this string as it is now. (Discussed with Sanjay.)

jhenshall commented 3 years ago

This is interesting thanks @szabozoltan69 ! It shows the need to better represent overseas branches in the dataset. With the current setup, if they select National Society as org type, then the National Society should be British RC or Netherlands RC but it's then a shame to overwrite this more granular overseas branch information. Great if you've already discussed with @batpad .