In refactoring this method, refactor some other areas:
- add a property to generate a dict needed for the "initial clin"
- add new relationship field to get all CLINs associated with a
portfolio
- add a property to either get or generate a portfolio's domain name
- least importantly, sort imports
- On the CLIN model, add a property to get a JEDI clin type's number,
i.e. JEDI_CLIN_3 -> 3. This should be the "initial_clin_type".
On my last PR to fix this, I didn't notice that CircleCI was setting the
shell to execute with `/bin/sh -eo pipefail`, which means that the
commands will fail if any part of the command exits with 1, regardless
of whether the result is being piped anywhere else. This updates the
shell that that section of the config uses.
https://circleci.com/docs/2.0/configuration-reference/#default-shell-options
The Azure CLI now returns an exit code of "1" if there are any warnings
when logging into a container registry. Since our longterm goal is to
move away from CircleCI, I chose to fix this in-place rather than
integrate a credentials store or pass more config values to a `docker
login` command. Instead, this just grep the output from the Azure CLI
command to ensure it succeeded.
Currently, we use both Python's built-in datetime library and Pendulum
to do datetime operations. For the sake of consistency, we should try to
stick to one library for datetimes. We could have used either, but
Pendulum has a more ergonomic API, so I decided to go with it when
possible.
The places where were we didn't / couldn't replace datetime are:
- checking instances of datetimes. Pendulum's objects are subclasses of
python native datetime objects, so it's still useful to import
datetime in those cases of using is_instance()
- WTForms date validators expect datetime style string formats --
Pendulum has its own format for formatting/ parsing strings. As such,
our custom validator DateRange needs to use datetime.stptime() to
account for this format.