Opened 14 years ago

Last modified 14 years ago

#94 new task

Refactor manage_officers and friends

Reported by: adehnert Owned by:
Priority: normal Milestone: Sometime
Component: People Version:
Keywords: Cc:
Size: medium

Description (last modified by adehnert)

manage_officers is no longer "a somewhat intimidating 100+ line long function with up to eight layers of indentation in some places" (ASA #87). Instead, it's a 250+ line morass of six functions with terrible APIs and uncertain purposes, with up to five layers of indent. Which... is a different problem. Sort of. It still wants to be cleaned up, until the various helper functions actually have a clear purpose in life, instead of being "lets yoink a chunk of 50 lines and slap the minimal function header that lets it run on".

Some likely-useful steps:

  • the new_people/max_new code should be split out into a separate utility function as much as possible. In particular, manage_officers_load_accounts and manage_officers_sync_role_people shouldn't care, ideally...
  • manage_offices_sync_role should get a set of relevant people (or possibly just old people), a set of people who should still be listed, and various extraneous info, and make them match up. This will make it a much better match for manager_officers_{table,bulk}_update, especially the latter.
  • manage_officers_load_accounts should ideally use some sort of built-in caching for everything using AthenaMoiraAccount. Failing that (as certainly might happen), it could at least not need to use new_people/max_new/request
  • Better function names might help

Change History (1)

comment:1 Changed 14 years ago by adehnert

  • Description modified (diff)
Note: See TracTickets for help on using tickets.