Skip to content
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

task/WP-109-remove-unused-django-fields #887

Merged
merged 7 commits into from
Oct 24, 2023

Conversation

tjgrafft
Copy link
Collaborator

Overview

Many fields connected to the PortalProfile model in the Django backend are no longer used by the portal. Remove all that are no longer needed from the model, and include related migrations.

Related

Changes

  • Removed several fields from PortalProfile model on django backend that were not being used in the CEP anymore (bio, website, orcid_id, etc)
  • Removed gender and ethnicity table headers from table on Manage Account page of CEP
  • Removed code from the related unit tests that were no longer needed bc fields were removed.
  • Removed code in fixtures that was testing for the unnecessary fields, as well.
  • Removed the two fields in related migrations file too.

Testing

  1. Log in to CEP
  2. Go to your username at the top right and open the dropdown
  3. Click on "My Account"
  4. View should match table format below. No ethnicity nor gender table header/value should be present
  5. Also check https://cep.test/accounts/api/profile/data/
  6. There should be no bio, orcid_id, professional_lvel, website, gender, or ethnicity key/value pairs in the api response on that page.

UI

Screenshot 2023-10-16 at 1 05 24 PM

Notes

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Merging #887 (1c30780) into main (f12180a) will increase coverage by 6.34%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #887      +/-   ##
==========================================
+ Coverage   63.33%   69.67%   +6.34%     
==========================================
  Files         427      220     -207     
  Lines       12245     6111    -6134     
  Branches     2514     1812     -702     
==========================================
- Hits         7755     4258    -3497     
+ Misses       4284     1779    -2505     
+ Partials      206       74     -132     
Flag Coverage Δ
javascript 69.67% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...c/components/ManageAccount/ManageAccountTables.jsx 76.00% <ø> (ø)

... and 207 files with indirect coverage changes

Copy link
Collaborator

@chandra-tacc chandra-tacc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested changes: remove all the unused code.

Question: edit profile leads to https://accounts.tacc.utexas.edu/profile, which shows the deleted fields. Is this ok?

Also, ran migrations locally:

root@07dc05f0e902:/srv/www/portal/server# python3 manage.py makemigrations
Migrations for 'accounts':
  portal/apps/accounts/migrations/0006_auto_20231017_1944.py
    - Remove field bio from portalprofile
    - Remove field orcid_id from portalprofile
    - Remove field professional_level from portalprofile
    - Remove field website from portalprofile
root@07dc05f0e902:/srv/www/portal/server# python3 manage.py migrate
Operations to perform:
  Apply all migrations: accounts, admin, auth, contenttypes, datafiles, googledrive, impersonate, notifications, onboarding, portal_auth, portal_licenses, portal_messages, projects, sessions, termsandconditions, webhooks, workspace
Running migrations:
  Applying accounts.0006_auto_20231017_1944... OK

@@ -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' },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove these instead of commenting them oout

website: 'http://owais.io',
orcid_id: 'test',
professional_level: 'Staff (support, administration, etc)',
// ethnicity: 'Asian',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, delete this unused code

Copy link
Collaborator Author

@tjgrafft tjgrafft Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I believe those values (on https://accounts.tacc.utexas.edu/profile) are different than the values that we're deleting on the backend. I say this because when I look at the api response on https://cep.test/accounts/api/profile/data/, those values are either empty strings or null for my profile, whereas on https://accounts.tacc.utexas.edu/profile, they are filled out. So my guess is this is separate from the PortalProfile data.

@tjgrafft tjgrafft changed the title task/WP-109-remove-unused-django-fields-v1 task/WP-109-remove-unused-django-fields Oct 17, 2023
Copy link
Member

@rstijerina rstijerina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good! Just want to undo that change to the init migration

Comment on lines 35 to 36
('ethnicity', models.CharField(max_length=255)),
('gender', models.CharField(max_length=255)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to keep old migrations unaltered, and rather all our future changes can be handled by additional migrations

Copy link
Collaborator

@chandra-tacc chandra-tacc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chandra-tacc
Copy link
Collaborator

@tjgrafft - server side unit tests are failing. Once this is fixed and tests pass, I can merge.

ERROR portal/apps/webhooks/unit_test.py::TestInteractiveWebhookView::test_unsupported_event_type - django.db.utils.IntegrityError: Problem installing fixture '/home/runner/work/Core-Portal/Core-Portal/server/portal/fixtures/users.json': Could not load accounts.PortalProfile(pk=1): NOT NULL constraint failed: accounts_portalprofile.ethnicity

@tjgrafft
Copy link
Collaborator Author

Should be fixed now with this new commit

@rstijerina rstijerina merged commit e427c97 into main Oct 24, 2023
6 checks passed
@rstijerina rstijerina deleted the task/WP-109-remove-unused-django-fields branch October 24, 2023 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants