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

Issue 177: Dev QOL Stuff; PI Department info and forms #493

Open
wants to merge 153 commits into
base: develop
Choose a base branch
from

Conversation

Hzaakk
Copy link
Collaborator

@Hzaakk Hzaakk commented Jan 14, 2023

Upgraded Python version from 3.6 to 3.8
Upgraded Postgres version from 9.6 to 10
Upgraded django-simple-history version from 2.12 to 3.2

Python installation now handled through SCL (via ansible role)

FIxed ansible role support

Removed hardcoded python and postgres versions and standardized booleans to true/false in ansible playbook

Dev QOL stuff in playbook

Added models for user department information

Added form and views for user department information

HOW TO TEST:

  • run ./manage.py populate_ldap_departments and ./manage.py populate_ldap_user_departments --only_pis to store department info
  • request to create a new project with a PI who doesn't have any department info in LDAP- It should prompt for their department.
  • assert department is shown as non-authoritative in user profile.
  • request to create a new project with a PI who has department info in LDAP. it shouldn't prompt
  • assert their department is shown as authoritative in user profile
  • test adding and removing non-authoritative departments in user profile.

@Hzaakk Hzaakk self-assigned this Jan 14, 2023
@Hzaakk Hzaakk changed the title WIP Issue 177: Python 3.7 -> 3.8; Postgres 9.6 -> 10; PI Department info and forms WIP Issue 177: Python 3.6 -> 3.8; Postgres 9.6 -> 10; PI Department info and forms Jan 14, 2023
@Hzaakk Hzaakk requested a review from matthew-li January 30, 2023 07:44
@Hzaakk Hzaakk changed the title WIP Issue 177: Python 3.6 -> 3.8; Postgres 9.6 -> 10; PI Department info and forms Issue 177: Python 3.6 -> 3.8; Postgres 9.6 -> 10; PI Department info and forms Jan 30, 2023
* Add departments plugin settings to test settings module
@matthew-li matthew-li changed the title Issue 177: Python 3.6 -> 3.8; Dev QOL Stuff; PI Department info and forms Issue 177: Dev QOL Stuff; PI Department info and forms Jan 17, 2025
@matthew-li
Copy link
Collaborator

Here's a summary of changes I've made:

  • Moved core.departments to plugins.departments
  • Removed references to departments from the UserProfile model to avoid needing the m2m_fields attribute of HistoricalRecords
  • Removed the upgrade to django-simple-history, which is no longer needed
  • Removed the upgrade to Python 3.8 and associated changes to the Ansible playbook, given that requirements are now unchanged
  • Added caching of department data within the CalNet LDAP backend to avoid repeated lookups
  • Updated the UserDepartment to have a foreign key to User, not UserProfile
  • Added a utility class UserDepartmentUpdater that updates the departments for a particular user
  • Modified the view for updating a user's department to also update the authoritative departments asynchronously
  • Modified the view for creating a new project to:
    • Perform the authoritative lookup asynchronously during processing, as opposed to during the request flow, to improve load times
    • Always ask for non-authoritative departments, if the PI does not have any
  • Added a django-flags condition app_installed that enables the USER_DEPARTMENTS_ENABLED flag if the plugin is installed in INSTALLED_APPS
  • Added YML configuration for the plugin
  • Added a qcluster service to the Docker environment for running asynchronous tasks
  • Updated how departments are rendered on the User Profile view and the user departments update view
  • Refactored code, fixed bugs, updated tests

@matthew-li
Copy link
Collaborator

@Hzaakk Can you review my changes and test that the functionality is working on your Docker instance? Run the loading commands, test the views, test export_data, etc.

Let me know if you run into any exceptions or other unexpected behavior.

Beyond that, I still need to write documentation, test that the Ansible playbook will work on staging, and maybe do some additional cleanup.

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.

2 participants