Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changes from 1 commit
c2cb573
6e62445
a8361b5
c443150
3d59799
ad4ced0
d62b410
b4a908d
6b99ddc
6db5193
d1b51f7
e11ba88
e584d84
4599f90
58ce5fa
062942a
2816b5d
afd6221
49a8a56
47c7222
0e9fb44
e9474f4
5196f68
dc7d1e0
f0b06bb
43b2aae
5e854ad
8ef2f99
aba9f4f
35bc6df
0780dce
93826a2
29f4edc
0f2b1c4
2f22c75
72de680
2d15e58
f1ad03d
ddf8676
8c95f93
4134e7f
b0ee873
2668fbf
acbf3dd
1f9a07a
8c20d4d
20306cd
fa1a690
21bc2e9
f59d3f2
eabb344
2439d76
0a49409
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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. TheTransferEvent
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.)
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!