145 Commits

Author SHA1 Message Date
leigh-mil
c2814416fb Update atst to atat 2020-03-04 11:51:15 -05:00
graham-dds
bb886dbe0f Add tests for portfolio.initial_clin_dict property
In doing this, fixed a bug on the clin.is_active property
2020-02-21 14:31:29 -05:00
graham-dds
d46ed2b5b4 Specify clin sorting in TO <> CLIN relationship
This also removes the sorted_clins property on the task_order model
2020-02-21 14:31:29 -05:00
graham-dds
108f65f928 Use pendulum for datetime operations when possible
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.
2020-02-17 10:38:52 -05:00
graham-dds
e553a673b1 Tests for total_obligated_funds portfolio prop 2020-02-11 14:27:29 -05:00
graham-dds
52489b6bca Add upcoming_obligated_funds property to portfolio 2020-02-11 14:27:29 -05:00
tomdds
13aca270ca Remove unused code in both the cloud interfaces and environment models. Also add tests for some untested code in the cloud interface. 2020-02-05 14:48:54 -05:00
tomdds
1a7db62dac Remove Environment level user provisioning 2020-02-04 15:22:34 -05:00
dandds
cc28f53999 Function for claiming multiple resources at once.
Like claim_for_update, the claim_many_for_update claims resources with
an expiring lock. This was written to allow the updating of multiple
application roles with a single cloud_id, since multiple application
roles will map to a single Azure Active Directory user.
2020-02-02 14:19:13 -05:00
leigh-mil
17864cc060 Add migration to change environment_roles role column from string to
enum type.
Fix tests and functions affected by the column type change.
2020-01-14 13:12:29 -05:00
leigh-mil
da398bf1ff Add status labels to portfolio managers table.
Update PortfolioRole.display_status() to return same type of data as
ApplicationRole.display_status().
2020-01-10 10:25:55 -05:00
graham-dds
aabedbcac4 Make PoP start and end dates inclusive.
Also removes the clock class.

Makes PoP date ranges inclusive such that a task order with:
-  a start date on or after the current date
and
- an end date on or before the current date
should be considered valid.

This commit also removes the Clock class. This class had two methods as
shortcuts for common uses of pendlum functions. But it wasn't being used
in very many places, and it took up about the same space as

    from pendulum import today()
    ...
    today(tz="UTC").date()

If we want to add this back in, it might be a good idea to extend it for
other time functions we have sprinkled around, like the random date
functions in our tests
2020-01-06 12:29:59 -05:00
leigh-mil
614514d6a2 Update tables to match business logic 2019-12-02 14:46:11 -05:00
graham-dds
7a0dc4d264 Add properties to portfolio model
1. Funding duration

Returns a tuple of the earliest period of performance start date and
latest period of performance end date for all active task order in a  portfolio.

2. Days to funding expiration
Returns the numbei of days between today and the lastest
period performance end date of all active task orders

3. Active task orders
Returns a list of a portfolio's active task orders a
2019-11-25 13:12:35 -05:00
leigh-mil
8aa302357b Move label display logic into the Label macro 2019-11-20 12:09:46 -05:00
leigh-mil
58a0b2dd9d Move display status logic to be a property of an ApplicationRole 2019-11-20 12:08:41 -05:00
leigh-mil
e5f83d2456 Update relationship between Environment and EnvironmentRole so only environment roles that are not deleted are included 2019-11-07 11:53:37 -05:00
leigh-mil
e64900245d Remove baseline_info column from environments table 2019-10-30 14:46:33 -04:00
graham-dds
a1c672d89f Conditionally skip tests related to audit log 2019-10-21 11:36:53 -04:00
richard-dds
96c1fcbe85
Merge branch 'master' into revert-user-deletion 2019-10-15 17:06:06 -04:00
leigh-mil
91ce3dda9e Disable the App Role when revoking an invite. 2019-10-15 14:25:21 -04:00
richard-dds
1bce0a1f01 Revert user deletion job 2019-10-14 16:51:19 -04:00
richard-dds
79c8e4fc63
Merge pull request #1062 from dod-ccpo/env-provisioning-task
Environment provisioning background jobs
2019-09-16 09:58:18 -04:00
graham-dds
2af0a2ecaf Update existing tests for new CLIN logic
- Factory adds total_amount field, which is always greater than obligated
field
- add total_amount field on tests that create TOs manually
- update tests that calculate total_contract_amount and
total_obligated_amount
2019-09-12 16:11:12 -04:00
richard-dds
365a50efce Add Environments.provisioning_status 2019-09-11 11:43:10 -04:00
richard-dds
f6cb6f2a31 Change Environment.creator relation from ApplicationRole to User 2019-09-11 11:42:59 -04:00
graham-dds
41bbbe8a39 add a sorted_clins property for clin sorting logic
CLINS have a special ordering:
 - First, they are sorted by the last three digits
 - Then, they are sorted by the first digit

Trying to add CLIN sorting logic to the relationship field in the task
order proved to be more challenging than expected. So, a separate
property was defined in order to access the clins in sorted order.
2019-09-04 12:35:56 -04:00
graham-dds
38ba8b7e5f LOAs are so out of this codebase 2019-08-30 09:57:23 -05:00
leigh-mil
96a2520e0c Don't use domain methods in tests 2019-08-19 10:39:16 -04:00
leigh-mil
2776926dea Move custom audit log logic into the User class 2019-08-19 10:25:26 -04:00
leigh-mil
0d6f7aa3cc Do not create AuditEvent if updating the User.last_login 2019-08-16 16:41:58 -04:00
dandds
9fc6514d80 Clean up defunct upload and CRL logic.
- Applies our previous CSP namespacing pattern to the upload classes.
- Removes code and config for previous uploader implementation.
- Removes Attachment model's ability to upload files directly and
  adjusts tests that expected that behavior.
2019-08-08 13:20:27 -04:00
leigh-mil
299804ade2 Check to make sure clins complete as part of checking if TO is complete 2019-07-29 15:50:50 -04:00
George Drummond
0f0a559dfa
TO Review Page 2019-06-12 09:43:00 -04:00
richard-dds
48d4b466b1 Formatting 2019-06-10 15:16:26 -04:00
richard-dds
c4d02bb026 Remove unused imports 2019-06-10 15:16:26 -04:00
richard-dds
e84e61bbad Update seed script with TOs of various statuses 2019-06-10 15:15:39 -04:00
richard-dds
0f4d17a94a Implemen TaskOrder.is_completed 2019-06-10 15:15:39 -04:00
richard-dds
8ecf112c48 Implement new CLIN-based TO statuses 2019-06-10 15:15:08 -04:00
richard-dds
7b8ccbf145 Implement TO start_date and end_date 2019-06-10 15:15:08 -04:00
dandds
c90e574e83
Merge pull request #869 from dod-ccpo/filter-app-environment-roles
Filter out deleted application environment roles
2019-06-05 10:50:06 -04:00
Montana
f462c3bd5e Add unit tests 2019-06-05 09:40:33 -04:00
dandds
82e048387e Filter out deleted application environment roles 2019-06-05 09:34:55 -04:00
dandds
c085db23d7 New invitation backend for portfolio invitations.
Portfolio invitations do not associate a user entity until the
invitation has been accepted. User info, including DOD ID, is held on
the invitation itself. When a user accepts and invitation, their user
entry is associated with the corresponding `portfolio_role` entry.

The same change will be applied to `application_role` and application
invitations. For now, small changes have been made to
application-related methods so that that flow works as-is.
2019-06-03 15:57:49 -04:00
leigh-mil
7bec073f78 Delete things related to deleted columns and table 2019-05-31 13:07:03 -04:00
dandds
df06d1b62f Use application_role_id on environment_roles.
In the future, an `application_invitation1 will not refer to a `user` until
someone accepts the invitation; they'll only reference an
`application_role`. When a user is invited to an application, the
inviter can specify the environments the invitee should have access to.
For this to be possible, an `environment_role` should reference an
`application_role`, because no `user` entity will be known at that time.

In addition to updating all the models and domain methods necessary for
this change, this commit deletes unused code and tests that were
dependent on `environment_roles` having a `user_id` foreign key.
2019-05-31 11:21:20 -04:00
dandds
96ae1bba9d
Merge pull request #845 from dod-ccpo/app-settings-role-id
Use role ID for app settings table
2019-05-28 11:43:56 -04:00
dandds
129f5e3031 Rewrite function that builds form data for app environment roles form.
- Adds a property to ApplicationRole model so that it knows its related
  EnvironmentRole models.
- Rewrite the form data builder in the routes file so that it loops the
  application members and their environment roles to build the data
  structure.
2019-05-24 13:34:53 -04:00
leigh-mil
8980b04f7e Filter the roles relationship on applications to remove deleted roles 2019-05-23 11:07:54 -04:00
dandds
c4ad7b4378 Make portfolio invitation specific to portfolio
- add a base domain class
- extract shared model code to mixin
- rename invitation classes
- invitation model relationship to portfolio_role name is now more
  generic "role"
2019-04-30 14:41:55 -04:00