From ad6363064c9e30505ab715a167d4d862e1d5c50a Mon Sep 17 00:00:00 2001 From: Taylor Grafft Date: Mon, 16 Oct 2023 11:49:15 -0500 Subject: [PATCH 1/4] task/WP-109-remove-unused-django-fields-v1 --- .../ManageAccount/ManageAccountTables.jsx | 4 ++-- .../tests/ManageAccountTables.test.js | 16 ++++++++-------- .../apps/accounts/migrations/0001_initial.py | 4 ++-- server/portal/apps/accounts/models.py | 12 ++++++------ server/portal/fixtures/accounts.json | 12 +++--------- server/portal/fixtures/users.json | 6 ------ 6 files changed, 21 insertions(+), 33 deletions(-) diff --git a/client/src/components/ManageAccount/ManageAccountTables.jsx b/client/src/components/ManageAccount/ManageAccountTables.jsx index 8ad1abbd4..3529e90ec 100644 --- a/client/src/components/ManageAccount/ManageAccountTables.jsx +++ b/client/src/components/ManageAccount/ManageAccountTables.jsx @@ -65,8 +65,8 @@ export const ProfileInformation = () => { { Header: 'Institution', accessor: 'institution' }, { Header: 'Country of Residence', accessor: 'country' }, { Header: 'Country of Citizenship', accessor: 'citizenship' }, - { Header: 'Ethnicity', accessor: 'ethnicity' }, - { Header: 'Gender', accessor: 'gender' }, + // { Header: 'Ethnicity', accessor: 'ethnicity' }, + // { Header: 'Gender', accessor: 'gender' }, ], [] ); diff --git a/client/src/components/ManageAccount/tests/ManageAccountTables.test.js b/client/src/components/ManageAccount/tests/ManageAccountTables.test.js index 3a655aaae..1208dc4b3 100644 --- a/client/src/components/ManageAccount/tests/ManageAccountTables.test.js +++ b/client/src/components/ManageAccount/tests/ManageAccountTables.test.js @@ -21,12 +21,12 @@ const dummyState = { }, data: { demographics: { - ethnicity: 'Asian', - gender: 'Male', - bio: '', - website: 'http://owais.io', - orcid_id: 'test', - professional_level: 'Staff (support, administration, etc)', + // ethnicity: 'Asian', + // gender: 'Male', + // bio: '', + // website: 'http://owais.io', + // orcid_id: 'test', + // professional_level: 'Staff (support, administration, etc)', username: 'ojamil', email: 'ojamil@tacc.utexas.edu', firstName: 'Owais', @@ -77,8 +77,8 @@ describe('Profile Information Component', () => { 'Institution', 'Country of Residence', 'Country of Citizenship', - 'Ethnicity', - 'Gender', + // 'Ethnicity', + // 'Gender', ]; headings.forEach((heading) => { expect(getByText(heading)).toBeInTheDocument(); diff --git a/server/portal/apps/accounts/migrations/0001_initial.py b/server/portal/apps/accounts/migrations/0001_initial.py index 0c835fb38..19421bf10 100644 --- a/server/portal/apps/accounts/migrations/0001_initial.py +++ b/server/portal/apps/accounts/migrations/0001_initial.py @@ -32,8 +32,8 @@ class Migration(migrations.Migration): name='PortalProfile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('ethnicity', models.CharField(max_length=255)), - ('gender', models.CharField(max_length=255)), + # ('ethnicity', models.CharField(max_length=255)), + # ('gender', models.CharField(max_length=255)), ('setup_complete', models.BooleanField(default=False)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), ], diff --git a/server/portal/apps/accounts/models.py b/server/portal/apps/accounts/models.py index 4f18ff8a1..259404f65 100644 --- a/server/portal/apps/accounts/models.py +++ b/server/portal/apps/accounts/models.py @@ -26,12 +26,12 @@ class PortalProfile(models.Model): related_name='profile', on_delete=models.CASCADE ) - ethnicity = models.CharField(max_length=255) - gender = models.CharField(max_length=255) - bio = models.CharField(max_length=4096, default=None, null=True, blank=True) - website = models.CharField(max_length=256, default=None, null=True, blank=True) - orcid_id = models.CharField(max_length=256, default=None, null=True, blank=True) - professional_level = models.CharField(max_length=256, default=None, null=True) + # ethnicity = models.CharField(max_length=255) + # gender = models.CharField(max_length=255) + # bio = models.CharField(max_length=4096, default=None, null=True, blank=True) + # website = models.CharField(max_length=256, default=None, null=True, blank=True) + # orcid_id = models.CharField(max_length=256, default=None, null=True, blank=True) + # professional_level = models.CharField(max_length=256, default=None, null=True) # Default to False. If PORTAL_USER_ACCOUNT_SETUP_STEPS is empty, # setup_complete will be set to True on first login diff --git a/server/portal/fixtures/accounts.json b/server/portal/fixtures/accounts.json index cf850fd7b..fdd870d93 100644 --- a/server/portal/fixtures/accounts.json +++ b/server/portal/fixtures/accounts.json @@ -3,27 +3,21 @@ "model": "accounts.portalprofile", "pk": 1, "fields": { - "user": 1, - "ethnicity": "", - "gender": "" + "user": 1 } }, { "model": "accounts.portalprofile", "pk": 2, "fields": { - "user": 2, - "ethnicity": "", - "gender": "" + "user": 2 } }, { "model": "accounts.portalprofile", "pk": 3, "fields": { - "user": 3, - "ethnicity": "", - "gender": "" + "user": 3 } }, { diff --git a/server/portal/fixtures/users.json b/server/portal/fixtures/users.json index baca595ba..a5410e9ad 100644 --- a/server/portal/fixtures/users.json +++ b/server/portal/fixtures/users.json @@ -58,12 +58,6 @@ "pk": 1, "fields": { "user": 1, - "ethnicity": "", - "gender": "", - "bio": null, - "website": null, - "orcid_id": null, - "professional_level": null, "setup_complete": true } } From 8f8c30c63e07d45c3ab60ff468dd19d109df066b Mon Sep 17 00:00:00 2001 From: Taylor Grafft Date: Tue, 17 Oct 2023 15:41:27 -0500 Subject: [PATCH 2/4] task/WP-109-remove-unused-django-fields-v2 --- .../ManageAccount/ManageAccountTables.jsx | 2 -- .../tests/ManageAccountTables.test.js | 8 ----- .../apps/accounts/migrations/0001_initial.py | 2 -- .../migrations/0006_auto_20231017_2033.py | 29 +++++++++++++++++++ server/portal/apps/accounts/models.py | 6 ---- 5 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 server/portal/apps/accounts/migrations/0006_auto_20231017_2033.py diff --git a/client/src/components/ManageAccount/ManageAccountTables.jsx b/client/src/components/ManageAccount/ManageAccountTables.jsx index 3529e90ec..ad360f725 100644 --- a/client/src/components/ManageAccount/ManageAccountTables.jsx +++ b/client/src/components/ManageAccount/ManageAccountTables.jsx @@ -65,8 +65,6 @@ export const ProfileInformation = () => { { Header: 'Institution', accessor: 'institution' }, { Header: 'Country of Residence', accessor: 'country' }, { Header: 'Country of Citizenship', accessor: 'citizenship' }, - // { Header: 'Ethnicity', accessor: 'ethnicity' }, - // { Header: 'Gender', accessor: 'gender' }, ], [] ); diff --git a/client/src/components/ManageAccount/tests/ManageAccountTables.test.js b/client/src/components/ManageAccount/tests/ManageAccountTables.test.js index 1208dc4b3..e10515297 100644 --- a/client/src/components/ManageAccount/tests/ManageAccountTables.test.js +++ b/client/src/components/ManageAccount/tests/ManageAccountTables.test.js @@ -21,12 +21,6 @@ const dummyState = { }, data: { demographics: { - // ethnicity: 'Asian', - // gender: 'Male', - // bio: '', - // website: 'http://owais.io', - // orcid_id: 'test', - // professional_level: 'Staff (support, administration, etc)', username: 'ojamil', email: 'ojamil@tacc.utexas.edu', firstName: 'Owais', @@ -77,8 +71,6 @@ describe('Profile Information Component', () => { 'Institution', 'Country of Residence', 'Country of Citizenship', - // 'Ethnicity', - // 'Gender', ]; headings.forEach((heading) => { expect(getByText(heading)).toBeInTheDocument(); diff --git a/server/portal/apps/accounts/migrations/0001_initial.py b/server/portal/apps/accounts/migrations/0001_initial.py index 19421bf10..a673acd82 100644 --- a/server/portal/apps/accounts/migrations/0001_initial.py +++ b/server/portal/apps/accounts/migrations/0001_initial.py @@ -32,8 +32,6 @@ class Migration(migrations.Migration): name='PortalProfile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - # ('ethnicity', models.CharField(max_length=255)), - # ('gender', models.CharField(max_length=255)), ('setup_complete', models.BooleanField(default=False)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), ], diff --git a/server/portal/apps/accounts/migrations/0006_auto_20231017_2033.py b/server/portal/apps/accounts/migrations/0006_auto_20231017_2033.py new file mode 100644 index 000000000..7b717497e --- /dev/null +++ b/server/portal/apps/accounts/migrations/0006_auto_20231017_2033.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.20 on 2023-10-17 20:33 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0005_auto_20210316_1950'), + ] + + operations = [ + migrations.RemoveField( + model_name='portalprofile', + name='bio', + ), + migrations.RemoveField( + model_name='portalprofile', + name='orcid_id', + ), + migrations.RemoveField( + model_name='portalprofile', + name='professional_level', + ), + migrations.RemoveField( + model_name='portalprofile', + name='website', + ), + ] diff --git a/server/portal/apps/accounts/models.py b/server/portal/apps/accounts/models.py index 259404f65..51513a212 100644 --- a/server/portal/apps/accounts/models.py +++ b/server/portal/apps/accounts/models.py @@ -26,12 +26,6 @@ class PortalProfile(models.Model): related_name='profile', on_delete=models.CASCADE ) - # ethnicity = models.CharField(max_length=255) - # gender = models.CharField(max_length=255) - # bio = models.CharField(max_length=4096, default=None, null=True, blank=True) - # website = models.CharField(max_length=256, default=None, null=True, blank=True) - # orcid_id = models.CharField(max_length=256, default=None, null=True, blank=True) - # professional_level = models.CharField(max_length=256, default=None, null=True) # Default to False. If PORTAL_USER_ACCOUNT_SETUP_STEPS is empty, # setup_complete will be set to True on first login From 89c4b29a2b02846c294044f1fbde18ec2127f72a Mon Sep 17 00:00:00 2001 From: Taylor Grafft Date: Wed, 18 Oct 2023 13:25:01 -0500 Subject: [PATCH 3/4] task/WP-109-remove-unused-django-fields-v3 --- server/portal/apps/accounts/migrations/0001_initial.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/portal/apps/accounts/migrations/0001_initial.py b/server/portal/apps/accounts/migrations/0001_initial.py index a673acd82..0c835fb38 100644 --- a/server/portal/apps/accounts/migrations/0001_initial.py +++ b/server/portal/apps/accounts/migrations/0001_initial.py @@ -32,6 +32,8 @@ class Migration(migrations.Migration): name='PortalProfile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ethnicity', models.CharField(max_length=255)), + ('gender', models.CharField(max_length=255)), ('setup_complete', models.BooleanField(default=False)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), ], From 5dee19a3491aa3042af7c97ca5814046839444d2 Mon Sep 17 00:00:00 2001 From: Taylor Grafft Date: Wed, 18 Oct 2023 14:36:17 -0500 Subject: [PATCH 4/4] task/WP-109-remove-unused-django-fields-v4 --- ...uto_20231017_2033.py => 0006_auto_20231018_1927.py} | 10 +++++++++- server/portal/apps/accounts/models.py | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) rename server/portal/apps/accounts/migrations/{0006_auto_20231017_2033.py => 0006_auto_20231018_1927.py} (69%) diff --git a/server/portal/apps/accounts/migrations/0006_auto_20231017_2033.py b/server/portal/apps/accounts/migrations/0006_auto_20231018_1927.py similarity index 69% rename from server/portal/apps/accounts/migrations/0006_auto_20231017_2033.py rename to server/portal/apps/accounts/migrations/0006_auto_20231018_1927.py index 7b717497e..183c3ebd7 100644 --- a/server/portal/apps/accounts/migrations/0006_auto_20231017_2033.py +++ b/server/portal/apps/accounts/migrations/0006_auto_20231018_1927.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.20 on 2023-10-17 20:33 +# Generated by Django 3.2.20 on 2023-10-18 19:27 from django.db import migrations @@ -14,6 +14,14 @@ class Migration(migrations.Migration): model_name='portalprofile', name='bio', ), + migrations.RemoveField( + model_name='portalprofile', + name='ethnicity', + ), + migrations.RemoveField( + model_name='portalprofile', + name='gender', + ), migrations.RemoveField( model_name='portalprofile', name='orcid_id', diff --git a/server/portal/apps/accounts/models.py b/server/portal/apps/accounts/models.py index 51513a212..482c363f3 100644 --- a/server/portal/apps/accounts/models.py +++ b/server/portal/apps/accounts/models.py @@ -26,7 +26,6 @@ class PortalProfile(models.Model): related_name='profile', on_delete=models.CASCADE ) - # Default to False. If PORTAL_USER_ACCOUNT_SETUP_STEPS is empty, # setup_complete will be set to True on first login setup_complete = models.BooleanField(default=False)