-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2427 internal users can transfer a facility or operation #2557
2427 internal users can transfer a facility or operation #2557
Conversation
1f49c5b
to
0fd9214
Compare
e3ac1c1
to
294eb31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm making some notes here, not finished testing yet so I might rescind them as I get further along.
Is the transfers dashboard meant to have another tile? (If it is I suggest separate card and PR)
This might just be a dev data thing, but I don't think I'm getting the full list of operations. Existing Operator 2 has lots of operations but I'm only getting Operation 7:
If I transfer something with a date in the past, I get a confirmation that says it's already been transferred, and then I see the transferred status in the table instead of complete. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some comments, anything that has a w
in it means I want to talk about it in the walkthrough
bc_obps/registration/schema/v1/facility_designated_operation_timeline.py
Outdated
Show resolved
Hide resolved
@@ -39,3 +40,25 @@ def list_timeline_by_operation_id( | |||
sort_by = f"{sort_direction}{sort_field}" | |||
base_qs = cls.get_timeline_by_operation_id(user, operation_id) | |||
return filters.filter(base_qs).order_by(sort_by) | |||
|
|||
@classmethod | |||
def get_current_timeline( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I wasn't sure what this service is meant to do based on the name and return value. Are we trying to get the info for whomever the facility currently belongs to? If so, get_current_designated_operation
might be clearer.
If I've understood the PR correctly (I made some notes in the docs), then I suggest adding a comment to explain why there's only going to be one record without an end_date
bc_obps/service/operation_designated_operator_timeline_service.py
Outdated
Show resolved
Hide resolved
bc_obps/service/tests/data_access_service/test_data_access_contact_service.py
Show resolved
Hide resolved
docs/backend/events/transfer.md
Outdated
- Create a new timeline record using the | ||
`FacilityDesignatedOperationTimelineDataAccessService.create_facility_designated_operation_timeline` service. This | ||
new record links the facility to the new operation, sets the start date to the transfer's effective date, and sets | ||
the status to `ACTIVE`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding what happens in the TransferEvent
model at this point
docs/backend/events/transfer.md
Outdated
3. Create a new timeline record using the | ||
`OperationDesignatedOperatorTimelineDataAccessService.create_operation_designated_operator_timeline` service. This | ||
new record links the operation to the new operator, sets the start date to the transfer's effective date, and sets | ||
the status to `ACTIVE`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
to a new operator. These events can be initiated for a specific date in the future, or they can be set to take effect | ||
immediately. | ||
|
||
## How do Transfer Events Work? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding something about how the models, statuses, and dates all interact throughout this process. That was the most confusing part for me. I'll type up how I ~think it works for looking at the code, feel free to use some of this in the docs if it's helpful.
When an internal user creates a transfer, it goes into the TransferEvent
model with a status of TO_BE_TRANSFERRED and the effective date from the form. (Provided there aren't any existing transfers that it overlaps with.) If the effective date is in the past, the transfers is immediately processed and a record is created in the timeline table with a status of ACTIVE and an empty end date. If there was already a timeline record, that one gets an end date set and the status set to TRANSFERRED. The TransferEvent
model then gets the status set to COMPLETE? (When would we ever use the TRANSFERRED status in this model?)
If the effective date is in the future, nothing happens to the timeline tables. Once the date passes, the chronjob adds to the timeline tables as described above.
As a result of all this, we can always trust that the record in the timeline table that doesn't have an end_date is the active one. (We never check or filter for ACTIVE status, but checking for a null end date is the same thing.)
fromOperatorId={formState.from_operator} | ||
toOperatorId={formState.to_operator} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we pass the legal_name instead of the id? (Is that stored in the form state anywhere, or only in the schema?) Then we wouldn't need to additionally pass operators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not storing the legal_name here, we just store IDs, that is why we need to pass the whole operators down.
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
…nd added end_date as a new filter Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
…ed by the same facility uuid for different transfers Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
…pdate tests Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
Signed-off-by: SeSo <[email protected]>
97cdab7
to
eabb344
Compare
Signed-off-by: SeSo <[email protected]>
2. **Timeline Update:** | ||
- The operation's current timeline (linking it to its current operator) is updated similarly to facilities. | ||
- A new timeline record is created for the new operator. | ||
3. **TransferEvent Status:** Updated to `TRANSFERRED`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, Sepehr, thanks for including so much detail and the examples!
Update the operator for the operation | ||
At the time of implementation, this is only used for transferring operations between operators and, | ||
is only available to cas_analyst users | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this!!
Signed-off-by: SeSo <[email protected]>
ISSUE 1949
&&
ISSUE 2427
🗒️ NOTES:
cas_analyst
as the new user roleall
from backend error util if error was a generic backend error (We don't want to seeAll:<rest of the error>
in the UI)allowedRoles
prop on dashboard tile links🧪 TEST:
Make a Transfer
button