harvard-lil / perma

Indelible links
417 stars 71 forks source link

Tweak /manage/organizations page for efficiency #3477

Closed rebeccacremona closed 7 months ago

rebeccacremona commented 7 months ago

As written, the manage_organization view function handles both GET and POST.

POST is simpler than GET; POST just processes a form, while GET retrieves a bunch of data about all the orgs visible to the user.

If we redesign this view (which we probably will), or if I were really refactoring, I'd split these out into separate view functions.

But, for now, almost as good: this PR just reorders the logic, quickly handling the form and returning if this is a POST, instead of collecting the data regardless of method.

This should speed up POST, and potentially ward off a weird edge case where, if a user submits multiple POSTs at exactly the right moments, instead of just successfully creating multiple orgs, the database gets itself in a bind.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (df311d9) 71.25% compared to head (2ee559a) 71.25%. Report is 7 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3477 +/- ## ======================================== Coverage 71.25% 71.25% ======================================== Files 48 48 Lines 6505 6505 ======================================== Hits 4635 4635 Misses 1870 1870 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.