ubccr / coldfront

HPC Resource Allocation System
https://coldfront.readthedocs.io
GNU General Public License v3.0
101 stars 80 forks source link

Refactor of Allocation views.py #441

Closed claire-peters closed 2 years ago

claire-peters commented 2 years ago

I noticed the note on messy logic in AllocationChangeView.post() and thought I would try simplifying the method a bit. To eliminate unnecessary else statements and make it easier to follow the method logic, I changed the if statements to look for errors instead of check whether conditions were right to proceed.

I also performed a few other small refactoring tasks - removed unused imports, made small restructures to remove repeating code, removed unneeded else statements where they did not appear to improve legibility, etc.

I also added two functions for checking the permissions statuses of different users which I found helpful in the development of permissions-dependent views on the FASRC branch.

aebruno commented 2 years ago

@claire-peters Thanks so much for your work on this. We found a few other bugs/issues and decided to merge your changes in this PR with a new branch. Closing this in favor of #458.